summaryrefslogtreecommitdiffstats
path: root/usr/local/bin/checkreload.sh
blob: b1c172309dc9088f93182a8bfac58702b69dc0cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

CHECKRELOADSTATUS=`pgrep check_reload_status | wc -l`
DATE=`date +%m-%d-%Y_at_%H%M%S`
OUTFILE=/root/check_reload_status.log

if [ ${CHECKRELOADSTATUS} -lt 1 ] ; then
        echo "${DATE}: Re-starting check_reload_status, it died for some reason..." >> ${OUTFILE}
        nohup /usr/bin/nice -n20 /usr/local/sbin/check_reload_status &
fi

if [ ${CHECKRELOADSTATUS} -gt 1 ] ; then
        echo "${DATE} There appears to be 2 or more check_reload_status processes. Forcing kill and restart of all now..." >> ${OUTFILE}
        kill -9 `pgrep check_reload_status`
		nohup /usr/bin/nice -n20 /usr/local/sbin/check_reload_status &
fi
OpenPOWER on IntegriCloud