]> git.pld-linux.org Git - packages/sanlock.git/blame - sanlock-init-pld.patch
- updated to 3.9.1, readded SysV scripts for sanlock and wdmd
[packages/sanlock.git] / sanlock-init-pld.patch
CommitLineData
b4891056
JB
1--- sanlock-3.8.0/init.d/sanlock-sysv.orig 2020-02-08 22:16:26.415493120 +0100
2+++ sanlock-3.8.0/init.d/sanlock-sysv 2020-02-08 22:25:28.369223771 +0100
7140d736 3@@ -32,95 +32,86 @@
c4ff6f07
JB
4 [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
5
6 start() {
7- [ -x $exec ] || exit 5
8-
f0345fc4
JB
9- if [ ! -d /run/$prog ]; then
10- install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 /run/$prog
11- [ -x /sbin/restorecon ] && restorecon /run/$prog
c4ff6f07
JB
12+ # Check if the service is already running?
13+ if [ -f /var/lock/subsys/sanlock ]; then
14+ msg_already_running "sanlock"
15+ return
16 fi
a9d7d0e7 17
c4ff6f07 18- echo -n $"Starting $prog: "
a9d7d0e7
JB
19+ msg_starting "sanlock"
20 daemon $prog daemon $SANLOCKOPTS
7140d736 21 retval=$?
c4ff6f07 22- echo
7140d736
JB
23 [ $retval -eq 0 ] && touch $lockfile
24 return $retval
c4ff6f07
JB
25 }
26
27 stop() {
a9d7d0e7
JB
28+ if [ ! -f /var/lock/subsys/sanlock ]; then
29+ msg_not_running "sanlock"
30+ return
31+ fi
7140d736
JB
32 PID=$(pidofproc -p $runfile $prog)
33
34- echo -n $"Sending stop signal $prog ($PID): "
a9d7d0e7 35 killproc -p $runfile $prog -TERM
7140d736 36 retval=$?
c4ff6f07 37- echo
a9d7d0e7 38
7140d736
JB
39 if [ $retval -ne 0 ]; then
40 return $retval
58a43fea 41 fi
c4ff6f07 42
7140d736
JB
43- echo -n $"Waiting for $prog ($PID) to stop:"
44+ show "Waiting for %s (%s) to stop:" "$prog" "$PID"
58a43fea 45+ busy
7140d736 46
58a43fea 47 timeout=10
7140d736 48 while checkpid $PID; do
58a43fea
JB
49 sleep 1
50 timeout=$((timeout - 1))
51 if [ "$timeout" -le 0 ]; then
52- failure; echo
7140d736 53- return 1
58a43fea 54+ fail
7140d736
JB
55+ retval=1
56+ return $retval
58a43fea 57 fi
c4ff6f07 58 done
a9d7d0e7 59
58a43fea 60- success; echo
58a43fea 61+ ok
a9d7d0e7 62 rm -f $lockfile
7140d736 63 return $retval
c4ff6f07
JB
64 }
65
66-restart() {
7140d736
JB
67- rh_status_q && stop
68- start
c4ff6f07
JB
69-}
70-
58a43fea
JB
71-reload() {
72- restart
c4ff6f07
JB
73-}
74-
a9d7d0e7
JB
75-rh_status() {
76- status $prog
7140d736
JB
77-}
78-
c4ff6f07
JB
79-rh_status_q() {
80- rh_status >/dev/null 2>&1
7140d736
JB
81+condrestart() {
82+ if [ ! -f /var/lock/subsys/sanlock ]; then
83+ msg_not_running "sanlock"
84+ retval=$1
85+ return $retval
86+ fi
58a43fea 87+ stop && start
7140d736
JB
88+ retval=$?
89+ return $retval
c4ff6f07
JB
90 }
91
92 case "$1" in
93 start)
94- rh_status_q && exit 0
95- $1
96+ start
97 ;;
98 stop)
99- rh_status_q || exit 0
100- $1
101+ stop
102 ;;
103 restart)
104- $1
7140d736
JB
105+ stop
106+ start
c4ff6f07
JB
107 ;;
108- reload)
109- rh_status_q || exit 7
110- $1
111+ try-restart)
112+ condrestart 0
113 ;;
114 force-reload)
115- force_reload
116+ condrestart 7
117 ;;
118 status)
119- rh_status
120- ;;
121- condrestart|try-restart)
122- rh_status_q || exit 0
123- restart
a9d7d0e7 124+ status --pidfile $runfile sanlock
7140d736 125+ retval=$?
c4ff6f07
JB
126 ;;
127 *)
128- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
129- exit 2
7140d736 130+ msg_usage "$0 {start|stop|status|restart||try-restart|force-reload}"
c4ff6f07
JB
131+ exit 3
132 esac
133-exit $?
7140d736 134+exit $retval
b4891056
JB
135--- sanlock-3.8.0/init.d/wdmd-sysv.orig 2020-02-08 22:16:26.418826435 +0100
136+++ sanlock-3.8.0/init.d/wdmd-sysv 2020-02-08 22:32:56.383463337 +0100
f0345fc4 137@@ -42,114 +42,103 @@
51fef094 138 retval=$?
a9d7d0e7 139
51fef094 140 if [ $retval -ne 0 ]; then
a9d7d0e7
JB
141- echo -n $"Loading the softdog kernel module: "
142+ show "Loading the softdog kernel module: "
143 modprobe softdog && udevadm settle
51fef094
JB
144
145 watchdog_probe
146 retval=$?
147 if [ $retval -ne 0 ]; then
148- failure; echo
149+ fail
150 return 1
151 fi
152- success; echo
153+ ok
c4ff6f07 154 fi
7140d736 155 }
a9d7d0e7 156
7140d736 157 start() {
f0345fc4
JB
158- watchdog_check
159-
160- [ -x $exec ] || exit 5
161-
162- if [ ! -d /run/$prog ]; then
163- install -d -g $WDMDGROUP -m 775 /run/$prog
164- [ -x /sbin/restorecon ] && restorecon /run/$prog
7140d736 165+ # Check if the service is already running?
51fef094 166+ if [ -f $lockfile ]; then
7140d736
JB
167+ msg_already_running "wdmd"
168+ return
f0345fc4 169 fi
51fef094 170
c4ff6f07 171- echo -n $"Starting $prog: "
f0345fc4
JB
172+ watchdog_check
173+
c4ff6f07
JB
174+ msg_starting "wdmd"
175 daemon $prog $WDMDOPTS
7140d736 176 retval=$?
c4ff6f07 177- echo
7140d736
JB
178 [ $retval -eq 0 ] && touch $lockfile
179 return $retval
c4ff6f07
JB
180 }
181
182 stop() {
51fef094 183+ if [ ! -f $lockfile ]; then
c4ff6f07
JB
184+ msg_not_running "wdmd"
185+ return
186+ fi
7140d736
JB
187 PID=$(pidofproc -p $runfile $prog)
188
189- echo -n $"Sending stop signal $prog ($PID): "
190 killproc -p $runfile $prog -TERM
191 retval=$?
192- echo
193
194 if [ $retval -ne 0 ]; then
195 return $retval
196 fi
197
198- echo -n $"Waiting for $prog ($PID) to stop:"
199+ show "Waiting for %s (%s) to stop:" "$prog" "$PID"
200
201 timeout=10
202 while checkpid $PID; do
203 sleep 1
204 timeout=$((timeout - 1))
205 if [ "$timeout" -le 0 ]; then
206- failure; echo
207- return 1
208+ fail
209+ retval=1
210+ return $retval
211 fi
212 done
213
214- success; echo
215+ ok
216 rm -f $lockfile
217 return $retval
c4ff6f07
JB
218 }
219
51fef094
JB
220-restart() {
221- rh_status_q && stop
222+condrestart() {
223+ if [ ! -f $lockfile ]; then
224+ msg_not_running "wdmd"
225+ retval=$1
226+ return $retval
227+ fi
228+ stop
229 start
230 }
231
232-reload() {
233- restart
234-}
235-
236-rh_status() {
237- status $prog
238-}
239-
240-rh_status_q() {
241- rh_status >/dev/null 2>&1
242-}
243-
244 case "$1" in
245 start)
246- rh_status_q && exit 0
247 $1
248 ;;
249 stop)
250- rh_status_q || exit 0
251 $1
252 ;;
253 restart)
254- $1
255- ;;
256- reload)
257- rh_status_q || exit 7
258- $1
259+ stop
260+ start
261 ;;
262 watchdog-check)
263 watchdog_check
264 ;;
265 force-reload)
266- force_reload
267+ condrestart 7
268 ;;
269 status)
270- rh_status
271+ status --pidfile $runfile wdmd
272 ;;
273 condrestart|try-restart)
274 rh_status_q || exit 0
275- restart
276+ condrestart 0
277 ;;
278 *)
279- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
280- exit 2
281+ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
282+ exit 3
283 esac
284-exit $?
285+exit $retval
f0345fc4
JB
286--- sanlock-3.8.0/init.d/fence_sanlockd.orig 2019-06-12 21:07:38.000000000 +0200
287+++ sanlock-3.8.0/init.d/fence_sanlockd 2020-02-08 22:34:27.129638389 +0100
51fef094
JB
288@@ -33,42 +33,35 @@
289 [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
290
291 start() {
292- [ -x $exec ] || exit 5
51fef094
JB
293+ # Check if the service is already running?
294+ if [ -f /var/lock/subsys/sanlock ]; then
295+ msg_already_running "sanlock"
296+ return
297+ fi
f0345fc4 298
51fef094
JB
299 # start wdmd and sanlock daemons if they aren't running
300+ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 || /etc/rc.d/init.d/wdmd start
301+ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 || /etc/rc.d/init.d/sanlock start
302
303- service wdmd status > /dev/null 2>&1 || service wdmd start
304-
305- service sanlock status > /dev/null 2>&1 || service sanlock start
306-
f0345fc4 307- [ ! -d /run/$prog ] && install -d -m 775 /run/$prog
51fef094 308-
f0345fc4 309- [ ! -d /run/$agent ] && install -d -m 775 /run/$agent
51fef094
JB
310-
311- [ -n "$(which restorecon)" ] && \
312- [ -x "$(which restorecon)" ] && \
f0345fc4 313- restorecon /run/$prog
51fef094
JB
314-
315- [ -n "$(which restorecon)" ] && \
316- [ -x "$(which restorecon)" ] && \
f0345fc4 317- restorecon /run/$agent
51fef094
JB
318-
319- echo -n $"Starting $prog: "
320+ msg_starting "$prog"
321 daemon $prog $FENCESANLOCKDOPTS
322 retval=$?
323- echo
324 [ $retval -eq 0 ] && touch $lockfile
325 return $retval
326 }
327
328 stop() {
329+ if [ ! -f /var/lock/subsys/$prog ]; then
330+ msg_not_running "$prog"
331+ return
332+ fi
333 agent_ps="$(ps ax -o pid,args | grep fence_sanlock | grep -v grep | grep -v fence_sanlockd)"
334
335 [ -n "$agent_ps" ] && {
336 agent_pid="$(echo $agent_ps | awk '{print $1}')"
337- echo -n "cannot stop while $agent $agent_pid is running"
338- failure; echo
339- return 1
340+ echo "Cannot stop while $agent $agent_pid is running" >&2
341+ retval=1
342+ return $retval
343 }
344
345 # Ideally, we'd like a general way to check if anything
346@@ -78,17 +71,17 @@
347 if [ -d /sys/kernel/dlm/ ]; then
348 count="$(ls -A /sys/kernel/dlm/ | wc -l)"
349 if [ $count -ne 0 ]; then
350- echo -n "cannot stop while dlm lockspaces exist"
351- failure; echo
352- return 1
353+ echo "Cannot stop while dlm lockspaces exist" >&2
354+ retval=1
355+ return $retval
356 fi
357 fi
358
359 if [ -d /sys/kernel/config/dlm/cluster ]; then
360 # this dir exists while dlm_controld is running
361- echo -n "cannot stop while dlm is running"
362- failure; echo
363- return 1
364+ echo "Cannot stop while dlm is running" >&2
365+ retval=1
366+ return $retval
367 fi
368
369 PID=$(pidofproc -p $runfile $prog)
370@@ -96,10 +89,8 @@
371 # We have to use SIGHUP to mean stop because sanlock
372 # uses SIGTERM to mean that the lockspace failed.
373
374- echo -n $"Sending stop signal $prog ($PID): "
375 killproc -p $runfile $prog -HUP
376 retval=$?
377- echo
378
379 if [ $retval -ne 0 ]; then
380 return $retval
381@@ -113,75 +104,65 @@
382 echo "" > $fifofile
383 fi
384
385- echo -n $"Waiting for $prog ($PID) to stop:"
386+ show "Waiting for %s (%s) to stop:" "$prog" "$PID"
387
388 timeout=10
389 while checkpid $PID; do
390 sleep 1
391 timeout=$((timeout - 1))
392 if [ "$timeout" -le 0 ]; then
393- failure; echo
394+ fail
395 return 1
396 fi
397 done
398
399- success; echo
400+ ok
401 rm -f $lockfile
402
403 # stop wdmd and sanlock daemons if they are running
404-
405- service sanlock status > /dev/null 2>&1 && service sanlock stop
406-
407- service wdmd status > /dev/null 2>&1 && service wdmd stop
408+ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 && /etc/rc.d/init.d/sanlock stop
409+ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 && /etc/rc.d/init.d/wdmd stop
410
411 return $retval
412 }
413
c4ff6f07 414-restart() {
7140d736
JB
415- rh_status_q && stop
416- start
417-}
a9d7d0e7 418-
c4ff6f07
JB
419-reload() {
420- restart
421-}
422-
423-rh_status() {
424- status $prog
425-}
426-
427-rh_status_q() {
428- rh_status >/dev/null 2>&1
7140d736 429+condrestart() {
51fef094
JB
430+ if [ ! -f /var/lock/subsys/$prog ]; then
431+ msg_not_running "$prog"
7140d736 432+ retval=$1
51fef094 433+ return $retval
7140d736 434+ fi
51fef094
JB
435+ stop && start
436+ retval=$?
437+ return $retval
7140d736 438 }
51fef094
JB
439-
440+
c4ff6f07
JB
441 case "$1" in
442 start)
443- rh_status_q && exit 0
444- $1
445+ start
446 ;;
447 stop)
448- rh_status_q || exit 0
449- $1
450+ stop
451 ;;
452 restart)
453- $1
51fef094
JB
454+ stop && start
455 ;;
456 reload)
457 rh_status_q || exit 7
458 $1
c4ff6f07
JB
459 ;;
460 force-reload)
461- force_reload
462+ condrestart 7
463 ;;
51fef094 464 status)
c4ff6f07 465- rh_status
51fef094
JB
466+ status --pidfile $runfile $prog
467+ retval=$?
7140d736 468 ;;
51fef094 469 condrestart|try-restart)
c4ff6f07
JB
470- rh_status_q || exit 0
471- restart
51fef094 472+ condrestart 0
c4ff6f07
JB
473 ;;
474 *)
475- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
51fef094
JB
476- exit 2
477+ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
478+ exit 3
c4ff6f07 479 esac
51fef094 480 exit $?
This page took 0.187891 seconds and 4 git commands to generate.