Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:bmwiedemann:reproducible:distribution:ring1
sanlock
fence_sanlockd.init
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fence_sanlockd.init of Package sanlock
#!/bin/sh # # fence_sanlockd - daemon for fence_sanlock agent # # chkconfig: 2345 20 80 # description: starts and stops fence_sanlockd # ### BEGIN INIT INFO # Provides: fence_sanlockd # Required-Start: $time $syslog $remote_fs # Required-Stop: $syslog # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts and stops fence_sanlockd # Description: starts and stops fence_sanlockd ### END INIT INFO prog="fence_sanlockd" agent="fence_sanlock" daemonrundir="/var/run/$prog" agentrundir="/var/run/$agent" runfile="$daemonrundir/$prog.pid" fifofile="$daemonrundir/$prog.fifo" lockfile="/var/lock/subsys/$prog" exec="/usr/sbin/$prog" FENCESANLOCKDOPTS="-w" test -x $exec || { echo "$exec not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog . /etc/rc.status rc_reset case "$1" in start) # start wdmd and sanlock daemons if they aren't running service wdmd status > /dev/null 2>&1 || service wdmd start service sanlock status > /dev/null 2>&1 || service sanlock start if [ ! -d $daemonrundir ]; then install -d -m 775 $daemonrundir [ -x /sbin/restorecon ] && restorecon $daemonrundir fi if [ ! -d $agentrundir ]; then install -d -m 775 $agentrundir [ -x /sbin/restorecon ] && restorecon $agentrundir fi if [ -e $runfile ]; then if checkproc $exec ; then echo -n "$prog is already running." rc_status -v rc_exit else echo "Removing stale PID file $runfile." rm -f $runfile fi fi echo -n "Starting $prog " startproc $exec daemon $FENCESANLOCKDOPTS rc_status -v ;; stop) agent_ps="$(ps ax -o pid,args | grep $agent | grep -v grep | grep -v $prog)" [ -n "$agent_ps" ] && { agent_pid="$(echo $agent_ps | awk '{print $1}')" echo -n "cannot stop while $agent $agent_pid is running" rc_failed 1 rc_status -v rc_exit } # Ideally, we'd like a general way to check if anything # needs fencing to continue running, but without that, # check what we know, which is that dlm requires it. if [ -d /sys/kernel/dlm/ ]; then count="$(ls -A /sys/kernel/dlm/ | wc -l)" if [ $count -ne 0 ]; then echo -n "cannot stop while dlm lockspaces exist" rc_failed 1 rc_status -v rc_exit fi fi if [ -d /sys/kernel/config/dlm/cluster ]; then # this dir exists while dlm_controld is running echo -n "cannot stop while dlm is running" rc_failed 1 rc_status -v rc_exit fi PID=$(pidofproc -p $runfile $prog) # We have to use SIGHUP to mean stop because sanlock # uses SIGTERM to mean that the lockspace failed. echo -n $"Sending stop signal $prog ($PID)" killproc -p $runfile $prog -HUP retval=$? if [ $retval -ne 0 ]; then rc_failed 1 rc_status -v rc_exit fi # fence_sanlockd won't see the SIGHUP if it's # still waiting for config from the fifo, so # send invalid config to the fifo to make it fail. if [ -p $fifofile ]; then echo "" > $fifofile 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 echo -n "failed waiting for $prog ($PID) to stop" rc_failed 1 rc_status -v rc_exit fi done rm -f $lockfile # stop wdmd and sanlock daemons if they are running service sanlock status > /dev/null 2>&1 && service sanlock stop service wdmd status > /dev/null 2>&1 && service wdmd stop rc_status -v ;; try-restart) $0 status >/dev/null && $0 restart rc_status ;; restart) $0 stop $0 start rc_status ;; reload) killproc -HUP $exec rc_status -v ;; status) echo -n "Checking status of $prog " checkproc $exec rc_status -v ;; *) echo "Usage: $0 {start|stop|restart|try-restart|reload|status}" rc_failed 2 rc_exit ;; esac rc_exit
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor