#!/bin/sh ### BEGIN INIT INFO # Provides: sanlock # Required-Start: $time $syslog wdmd $remote_fs # Required-Stop: $syslog # Should-Start: # Should-Stop: # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: starts and stops sanlock daemon # Description: starts and stops sanlock daemon ### END INIT INFO SANLOCKBIN=/usr/sbin/sanlock SANLOCKRUNDIR=/var/run/sanlock SANLOCKPIDFILE=$SANLOCKRUNDIR/sanlock.pid SANLOCKUSER="sanlock" SANLOCKOPTS="-U $SANLOCKUSER -G $SANLOCKUSER" test -x $SANLOCKBIN || { echo "$SANLOCKBIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } [ -f /etc/sysconfig/sanlock ] && . /etc/sysconfig/sanlock . /etc/rc.status rc_reset case "$1" in start) if [ ! -d $SANLOCKRUNDIR ]; then install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 $SANLOCKRUNDIR [ -x /sbin/restorecon ] && restorecon $SANLOCKRUNDIR fi if [ -e $SANLOCKPIDFILE ]; then if checkproc $SANLOCKBIN ; then echo -n "sanlock is already running." rc_status -v exit else echo "Removing stale PID file $SANLOCKPIDFILE." rm -f $SANLOCKPIDFILE fi fi echo -n "Starting sanlock " startproc $SANLOCKBIN daemon $SANLOCKOPTS rc_status -v ;; stop) echo -n "Shutting down sanlock " killproc -TERM $SANLOCKBIN > /dev/null 2>&1 rm -f $SANLOCKPIDFILE rc_status -v ;; try-restart) $0 status >/dev/null && $0 restart rc_status ;; restart) $0 stop $0 start rc_status ;; reload) killproc -HUP $SANLOCKBIN rc_status -v ;; status) echo -n "Checking status of sanlock " checkproc $SANLOCKBIN rc_status -v ;; *) echo "Usage: $0 {start|stop|restart|try-restart|reload|status}" rc_failed 2 rc_exit ;; esac rc_exit