"Fossies" - the Fresh Open Source Software Archive

Member "freeipmi-1.6.8/etc/bmc-watchdog.init.in" (28 Mar 2021, 2852 Bytes) of package /linux/misc/freeipmi-1.6.8.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 #
    3 # chkconfig: - 99 01
    4 # description: bmc-watchdog startup script
    5 #
    6 ### BEGIN INIT INFO
    7 # Provides: bmc-watchdog
    8 # Required-Start: $network $remote_fs $syslog
    9 # Required-Stop:  $network $remote_fs $syslog
   10 # Default-Start:  3 5
   11 # Default-Stop:   0 1 2 6
   12 # Short-Description: Start and stop bmc-watchdog
   13 # Description: BMC watchdog timer daemon
   14 ### END INIT INFO
   15 
   16 DAEMON=@X_SBINDIR@/bmc-watchdog
   17 PIDFILE=@X_LOCALSTATEDIR@/run/bmc-watchdog.pid
   18 LOCKFILE=@X_LOCALSTATEDIR@/lock/subsys/bmc-watchdog
   19 CONFFILE=@X_SYSCONFDIR@/sysconfig/bmc-watchdog
   20 
   21 [ -f $DAEMON ] || exit 5
   22 
   23 if [ -r $CONFFILE ]; then
   24         . $CONFFILE
   25 fi
   26 
   27 # Load Redhat or Suse appropriate libs
   28 if [ -f @X_SYSCONFDIR@/rc.d/init.d/functions ] ; then
   29     . @X_SYSCONFDIR@/rc.d/init.d/functions
   30     Xstart() {
   31 
   32         # Default deamon mode
   33         #
   34         # timer use = SMS/OS
   35         # pre-timeout interrupt = none
   36         # action = reset
   37         # -F, -P, -L, -S, -O - clear flags
   38         # initial-countdown = 900 seconds (15 mins)
   39         # reset-period = 60 seconds
   40 
   41         daemon -20 $DAEMON $OPTIONS
   42         RETVAL=$?
   43         echo
   44         [ $RETVAL -eq 0 ] && touch $LOCKFILE
   45     }
   46     Xstop() {
   47         killproc bmc-watchdog
   48         RETVAL=$?
   49         echo
   50         [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
   51     }
   52     Xstatus() {
   53         status bmc-watchdog
   54         RETVAL=$?
   55         return $RETVAL
   56     }
   57     Xcondrestart() {
   58         if test -e $LOCKFILE; then
   59             $0 stop
   60             $0 start
   61             RETVAL=$?
   62         fi
   63     }
   64     Xexit() {
   65         exit $RETVAL
   66     }
   67 elif [ -f @X_SYSCONFDIR@/rc.status ] ; then
   68     . @X_SYSCONFDIR@/rc.status
   69     Xstart() {
   70         startproc -20 $DAEMON $OPTIONS
   71         rc_status -v
   72         RETVAL=$?
   73         return $RETVAL
   74     }
   75     Xstop() {
   76         killproc -TERM $DAEMON
   77         rc_status -v
   78         RETVAL=$?
   79         return $RETVAL
   80     }
   81     Xstatus() {
   82         echo -n "Checking for bmc-watchdog: "
   83         checkproc $DAEMON
   84         rc_status -v
   85         RETVAL=$?
   86         return $RETVAL
   87     }
   88     Xcondrestart() {
   89         $0 status
   90         if test $? = 0; then
   91             $0 restart
   92         else
   93             rc_reset
   94         fi
   95         rc_status
   96         RETVAL=$?
   97         return $RETVAL
   98     }
   99     Xexit() {
  100         rc_exit
  101     }
  102 else
  103     echo "Unknown distribution type"
  104     exit 1
  105 fi
  106 
  107 RETVAL=0
  108 
  109 case "$1" in
  110    start)
  111         echo -n "Starting bmc-watchdog: "
  112         Xstatus >/dev/null 2>&1 && exit 0
  113         Xstart
  114         ;;
  115 
  116   stop)
  117         echo -n "Shutting down bmc-watchdog: "
  118         Xstop
  119         ;;
  120 
  121   restart)
  122         $0 stop
  123         $0 start
  124         RETVAL=$?
  125         ;;
  126   status)
  127         Xstatus
  128         ;;
  129   condrestart|try-restart|force-reload)
  130         Xcondrestart
  131         ;;
  132   *)
  133         echo "Usage: $0 {start|stop|restart|status|condrestart|try-restart|force-reload}"
  134         exit 2
  135 esac
  136 
  137 exit $RETVAL