Created
June 19, 2013 07:45
-
-
Save wdalmut/5812375 to your computer and use it in GitHub Desktop.
Just a simple shell watchdog...
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
| #!/bin/bash | |
| PS=/bin/ps | |
| GREP=/bin/grep | |
| PROCESS_NAME=wftpserver | |
| START="/etc/init.d/wftpserver start" | |
| NOP=/bin/true | |
| LOGGER=/usr/bin/logger | |
| $PS -ef | $GREP -v grep | $GREP $PROCESS_NAME > /dev/null 2>&1 | |
| case "$?" in | |
| 0) | |
| #Its running | |
| $LOGGER "$PROCESS_NAME is RUNNING OK. Relax..." | |
| $NOP | |
| ;; | |
| 1) | |
| $LOGGER "$PROCESS_NAME is NOT RUNNING. Starting $PROCESS_NAME and sending notices." | |
| $START | |
| esac | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment