summaryrefslogtreecommitdiff
path: root/scripts/ipmiutil_wdt
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ipmiutil_wdt')
-rwxr-xr-xscripts/ipmiutil_wdt46
1 files changed, 16 insertions, 30 deletions
diff --git a/scripts/ipmiutil_wdt b/scripts/ipmiutil_wdt
index b3ffcf1..d253ec3 100755
--- a/scripts/ipmiutil_wdt
+++ b/scripts/ipmiutil_wdt
@@ -20,18 +20,13 @@
# Description: Init script to enable and reset ipmiutil watchdog timer via cron
### END INIT INFO
#
-#if [ -f /etc/init.d/functions ]; then
-# Source function library.
-#. /etc/init.d/functions
-#fi
name=ipmiutil_wdt
prog="/usr/bin/ipmiutil wdt"
wdtcron=/etc/cron.d/wdt
LOCKFILE=/var/lock/subsys/$name
wdtlog=/var/log/$name
-#tmpcron=/tmp/wdtcron.$$
-# tmpcron2=/tmp/wdtcron2.$$
+wdtsec=150 # default 150 seconds for watchdog timeout (2*60 + 30)
start() {
echo -n "Starting $prog: "
@@ -48,26 +43,19 @@ start() {
echo "No ipmi driver loaded, aborting."
RETVAL=1
else
- # configure the watchdog for a 90 second timeout
- $prog -e -t 90 >$wdtlog
+ # configure the watchdog for a 150 second timeout
+ $prog -e -t $wdtsec >$wdtlog
RETVAL=$?
- if [ $RETVAL -eq 0 ]
- then
- # restart the watchdog every 60 seconds via crontab (skip)
- # cat - <<%%% >$tmpcron
-#* * * * * $prog -r
-#%%%
- # crontab $tmpcron
- # RETVAL=$?
- # restart the watchdog every 60 seconds via /etc/cron.d
- cat - <<%%% >$wdtcron
+ if [ $RETVAL -eq 0 ]; then
+ # restart the watchdog every 60 seconds via /etc/cron.d
+ cat - <<%%% >$wdtcron
* * * * * root $prog -r >/dev/null
%%%
# make crond re-read the /etc/cron.d
- $crond_sh restart >>$wdtlog
+ $restart_cron >>$wdtlog
touch $LOCKFILE
fi
- fi
+ fi
echo
return $RETVAL
}
@@ -79,16 +67,13 @@ stop() {
$prog -d >>$wdtlog
RETVAL=$?
# now remove the wdt cron job
- # crontab -l >$tmpcron
- # grep -v $prog $tmpcron |grep -v "^#" >$tmpcron2
- # crontab $tmpcron2
- rm -f $wdtcron
+ rm -f $wdtcron
# make crond re-read the /etc/cron.d
- $crond_sh restart >>$wdtlog
+ $restart_cron >>$wdtlog
rm -f ${LOCKFILE}
echo
return $RETVAL
-}
+}
restart() {
stop
@@ -113,12 +98,13 @@ get_status() {
}
# Begin mainline script here
-if [ -f /etc/redhat-release ]
-then
- crond_sh=/etc/init.d/crond
+if [ -x /bin/systemctl ]; then
+ restart_cron='systemctl restart crond.service'
+elif [ -f /etc/redhat-release ]; then
+ restart_cron='/etc/init.d/crond restart'
else
# SuSE, MontaVista, etc.
- crond_sh=/etc/init.d/cron
+ restart_cron='/etc/init.d/cron restart'
fi
if [ ! -d /var/lock/subsys ]; then
LOCKFILE=/var/run/$name.pid