Created
February 17, 2018 02:09
-
-
Save dansku/83cbc8ff08c951ba58a2c3f02d68c3c8 to your computer and use it in GitHub Desktop.
restarting script when it crashes
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
#!/bin/sh | |
COMMAND='python /home/runcloud/parser/live.py' | |
LOGFILE=restart.txt | |
writelog() { | |
now=`date` | |
echo "$now $*" >> $LOGFILE | |
} | |
writelog "Starting" | |
while true ; do | |
$COMMAND | |
writelog "Exited with status $?" | |
writelog "Restarting" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment