rc.watchdog.suse

来自「watchdog source watchdog source」· SUSE 代码 · 共 96 行

SUSE
96
字号
#! /bin/sh# Copyright (c) 1995-1998 SuSE GmbH Nuernberg, Germany.## Author: Thorsten Bonow (Toto) <tb@lmbau.rwth-aachen.de>, 2000# Based on example /sbin/init.d/skeleton=20## /sbin/init.d/<watchdog.toto>##   and symbolic its link## /sbin/rc<watchdog.toto>#. /etc/rc.config# Determine the base and follow a runlevel link name.base=${0##*/}link=${base#*[SK][0-9][0-9]}# Force execution if not called by a runlevel directory.test $link = $base && START_FOO=yes## Up to now, there is no support for watchdog in the main SuSE=20# configuration file /etc/rc.config, read by the YaST setup tool## It would look that way in /etc/rc.config:## START_WATCHDOG=yes=20## Then you could use here in this script:# test "$START_WATCHDOG" = yes || exit 0# The echo return value for success (defined in /etc/rc.config).return=$rc_donecase "$1" in    start)	echo -n "Starting watchdog daemon"	## Start daemon with startproc(8). If this fails	## the echo return value is set appropriate.	startproc /usr/sbin/watchdog --softboot || return=$rc_failed	echo -e "$return"	;;    stop)	echo -n "Shutting down watchdog daemon"	## Stop daemon with killproc(8) and if this fails	## set echo the echo return value.	killproc -TERM /usr/sbin/watchdog || return=$rc_failed	echo -e "$return"	;;    restart)	## If first returns OK call the second, if first or	## second command fails, set echo return value.	$0 stop  &&  $0 start  ||  return=$rc_failed	;;    reload)	## Choose ONE of the following two cases:	## First possibility: A few services accepts a signal	## to reread the (changed) configuration.	#echo -n "Reload watchdog daemon"	#killproc -HUP /usr/sbin/watchdog || return=$rc_failed	#echo -e "$return"	## Exclusive possibility: Some services must be stopped	## and started to force a new load of the configuration.	$0 stop  &&  $0 start  ||  return=$rc_failed	;;    status)	echo -n "Checking for watchdog daemon: "	## Check status with checkproc(8), if process is running	## checkproc will return with exit status 0.	checkproc /usr/sbin/watchdog && echo OK || echo No process	;;    probe)	## Optional: Probe for the necessity of a reload,	## give out the argument which is required for a reload.	#test /etc/foo.conf -nt /var/run/foo.pid && echo reload	;;    *)	echo "Usage: $0 {start|stop|status|restart|reload[|probe]}"	exit 1	;;esac# Inform the caller not only verbosely and set an exit status.test "$return" = "$rc_done" || exit 1exit 0

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?