Created
March 25, 2019 16:17
-
-
Save 100daysofdevops/71afdf18f0f20aecae947c51eb7ffd85 to your computer and use it in GitHub Desktop.
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
| #!/usr/bin/env bash | |
| function servicecheck() | |
| { | |
| ps aux | grep -v grep |grep $1 >/dev/null | |
| if [ $? != 0 ] | |
| then | |
| echo $1 "is not running"; | |
| systemctl start $1 | |
| else | |
| echo $1 "is up and running"; | |
| fi; | |
| } | |
| servicecheck "httpd" | |
| servicecheck "rsyslogd" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment