Created
November 12, 2021 05:54
-
-
Save karthicraghupathi/80847f0bdfb0adea682a8ae33b2e43e1 to your computer and use it in GitHub Desktop.
SSH - Keep Tasks Running Through Disconnects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a command that is currently running. | |
# First suspend current command | |
CTRL + Z | |
# Get a list of current jobs | |
jobs -l | |
# Then resume execution of the command in the background | |
bg | |
# Finally disown the command so it continues to run on disconnecting terminal | |
disown -h %1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When issuing new commands. | |
# The following will: | |
# - start executing the command and put it in background | |
# - redirect stdout and stderr to output.log | |
# - will also continue running the command on disconnecting terminal | |
nohup command > output.log 2&>1 & | |
# Get a list of current jobs | |
jobs -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great reference: https://www.baeldung.com/linux/job-control-disown-nohup