Created
July 7, 2016 22:01
-
-
Save gregjhogan/b0f858fe078bd4f84170ee2a18a9bde6 to your computer and use it in GitHub Desktop.
cron job to keep process running
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
| #!/bin/sh | |
| # crontab: * * * * * /{path}/{to}/{script}.sh | |
| ps -ef | grep 'node {script}' | grep -v grep > /dev/null | |
| if [ $? != 0 ] | |
| then | |
| cd /{working}/{dir} | |
| nohup node {script} > /dev/null 2>&1 & | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment