Created
December 16, 2018 22:40
-
-
Save AysadKozanoglu/4298111d6f98b9f79e8c0e0a381ea3de to your computer and use it in GitHub Desktop.
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 | |
# Author: Aysad Kozanoglu | |
SERVICE='nginx' | |
DATE=$(date '+%Y-%m-%d %H:%M:%S') | |
NGINXBIN=$(which nginx) | |
LOGTO=/var/log/serviceChecker.log | |
if ps ax | grep -v grep | grep $SERVICE > /dev/null | |
then | |
echo "$DATE $SERVICE service running, everything is fine" >> $LOGTO | |
else | |
echo "$DATE $SERVICE service is not running... starting now " >> $LOGTO | |
$NGINXBIN | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment