Created
September 8, 2019 12:43
-
-
Save repodevs/84300268e0ff23195cf2792f90011efe to your computer and use it in GitHub Desktop.
Linux command to run script (program) in background without killed
This file contains 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 we running script in background using `&` after we logout, the script will be killed, | |
# to prevent the script being killed we can use `nohup` | |
$ nohup bash -c "time python myapp.py" > myapp.log 2>&1 & | |
# this command will run our script in background (even we logout from terminal session) | |
# and we can still watching the log from `myapp.log` | |
# e.g `tail -f myapp.log` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment