From bf5b1dd00ca6c9c8b49011af0d673752ff124697 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Jan 10 2024 23:05:09 +0000 Subject: wdmd: remove unused init script code from helper Leave the watchdog-check function that's called from the systemd service to load the softdog module if no watchdog is enabled. --- diff --git a/init.d/wdmd b/init.d/wdmd index b6a2a79..0016097 100644 --- a/init.d/wdmd +++ b/init.d/wdmd @@ -1,35 +1,10 @@ #!/bin/bash # # wdmd - watchdog multiplexing daemon +# helper to load the softdog module if a watchdog is not enabled # -# chkconfig: 2345 97 03 -# description: starts and stops wdmd daemon -# - - -### BEGIN INIT INFO -# Provides: wdmd -# Required-Start: $time $syslog -# Required-Stop: $syslog -# Should-Start: -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: starts and stops wdmd daemon -# Description: starts and stops wdmd daemon -### END INIT INFO - -. /etc/rc.d/init.d/functions - -prog="wdmd" -runfile="/run/$prog/$prog.pid" -lockfile="/var/lock/subsys/$prog" -exec="/usr/sbin/$prog" - -WDMDGROUP="sanlock" -WDMDOPTS="-G $WDMDGROUP" -[ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog +exec="/usr/sbin/wdmd" watchdog_probe() { $exec --probe > /dev/null 2>&1 @@ -43,113 +18,25 @@ watchdog_check() { if [ $retval -ne 0 ]; then echo -n $"Loading the softdog kernel module: " - modprobe softdog && udevadm settle + modprobe softdog watchdog_probe retval=$? if [ $retval -ne 0 ]; then - failure; echo + echo "failed" return 1 fi - success; echo - fi -} - -start() { - watchdog_check - - [ -x $exec ] || exit 5 - - if [ ! -d /run/$prog ]; then - install -d -g $WDMDGROUP -m 775 /run/$prog - [ -x /sbin/restorecon ] && restorecon /run/$prog - fi - - echo -n $"Starting $prog: " - daemon $prog $WDMDOPTS - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop() { - PID=$(pidofproc -p $runfile $prog) - - echo -n $"Sending stop signal $prog ($PID): " - killproc -p $runfile $prog -TERM - retval=$? - echo - - if [ $retval -ne 0 ]; then - return $retval + echo "success" + return 0 fi - - echo -n $"Waiting for $prog ($PID) to stop:" - - timeout=10 - while checkpid $PID; do - sleep 1 - timeout=$((timeout - 1)) - if [ "$timeout" -le 0 ]; then - failure; echo - return 1 - fi - done - - success; echo - rm -f $lockfile - return $retval -} - -restart() { - rh_status_q && stop - start -} - -reload() { - restart -} - -rh_status() { - status $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 } case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; watchdog-check) watchdog_check ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; *) - echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + echo $"Usage $0 watchdog-check" exit 2 esac exit $?