Created
May 7, 2020 17:02
-
-
Save kbbgl/0dd470756018ba3aeaddea966a55a225 to your computer and use it in GitHub Desktop.
[run script in background] #linux #bash
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
# give executable permissions to script | |
chmod u+x run_monitoring | |
# run script in background and get pid for killing to stdout | |
nohup ./run_monitoring.sh > monitor_metrics.txt 2>&1 & | |
# save PID to kill | |
echo $! > save_pid.txt | |
# to kill process | |
kill -9 `cat save_pid.txt` | |
rm save_pid.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment