Created
September 10, 2015 15:17
-
-
Save rbocchinfuso/46e128597e0e798f761c to your computer and use it in GitHub Desktop.
hubot keepalive script
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 | |
# Add to crontab | |
# */5 * * * * ~/hubotAlive.sh hubot | |
hubotName=$1 | |
hubotPID=$(ps -aux | grep -w node | grep -w ${hubotName} | grep -v grep | awk '{print $2}') | |
echo "hubot PID: ${hubotPID}" | |
if [ -n "${hubotPID// }" ] ; then | |
echo "`date`: $hubotName service running, everything is fine" | |
else | |
echo "`date`: $hubotName service NOT running, starting service." | |
cd /home/hubot/${hubotName}/bin | |
/home/hubot/${hubotName}/bin/${hubotName}.sh start > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment