Created
July 23, 2014 12:28
-
-
Save danigosa/3fa853a69d28ffef5453 to your computer and use it in GitHub Desktop.
Supervise processes
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/bash | |
# Script to supervise processes | |
# Full supervisord config here: https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps | |
while true | |
do | |
SERVICE="$1" | |
RESULT=`killall -q -0 $1 && echo running` | |
if [ "${RESULT:-null}" = null ]; then | |
echo "Not running!, Starting process..." | |
# Start targeted process here! | |
sudo /etc/init.d/celeryd start | |
sleep 1 | |
else | |
echo "Running!" | |
sleep "$2" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment