]> git.pld-linux.org Git - packages/sanlock.git/blame - sanlock-init-pld.patch
- updated to 3.6.0
[packages/sanlock.git] / sanlock-init-pld.patch
CommitLineData
7140d736
JB
1--- sanlock-2.5/init.d/sanlock.orig 2012-09-30 10:16:54.308331928 +0200
2+++ sanlock-2.5/init.d/sanlock 2012-09-30 10:51:21.691622171 +0200
3@@ -32,95 +32,86 @@
c4ff6f07
JB
4 [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
5
6 start() {
7- [ -x $exec ] || exit 5
8-
9- if [ ! -d /var/run/$prog ]; then
a9d7d0e7 10- install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 /var/run/$prog
c4ff6f07
JB
11- [ -x /sbin/restorecon ] && restorecon /var/run/$prog
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
51fef094
JB
135--- sanlock-3.2.4/init.d/wdmd.orig 2015-09-10 17:23:16.258102320 +0200
136+++ sanlock-3.2.4/init.d/wdmd 2015-09-10 17:31:02.341416003 +0200
137@@ -42,114 +42,105 @@
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
JB
157 start() {
158+ # Check if the service is already running?
51fef094 159+ if [ -f $lockfile ]; then
7140d736
JB
160+ msg_already_running "wdmd"
161+ return
162+ fi
163+
164 watchdog_check
165
51fef094
JB
166 [ -x $exec ] || exit 5
167
7140d736
JB
168- if [ ! -d /var/run/$prog ]; then
169- install -d -g $WDMDGROUP -m 775 /var/run/$prog
170- [ -x /sbin/restorecon ] && restorecon /var/run/$prog
171- fi
172-
c4ff6f07
JB
173- echo -n $"Starting $prog: "
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
286--- sanlock-3.2.4/init.d/fence_sanlockd.orig 2015-06-19 18:26:03.000000000 +0200
287+++ sanlock-3.2.4/init.d/fence_sanlockd 2015-09-10 20:58:46.917559578 +0200
288@@ -33,42 +33,35 @@
289 [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
290
291 start() {
292- [ -x $exec ] || exit 5
293-
294+ # Check if the service is already running?
295+ if [ -f /var/lock/subsys/sanlock ]; then
296+ msg_already_running "sanlock"
297+ return
298+ fi
299+
300 # start wdmd and sanlock daemons if they aren't running
301+ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 || /etc/rc.d/init.d/wdmd start
302+ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 || /etc/rc.d/init.d/sanlock start
303
304- service wdmd status > /dev/null 2>&1 || service wdmd start
305-
306- service sanlock status > /dev/null 2>&1 || service sanlock start
307-
308- [ ! -d /var/run/$prog ] && install -d -m 775 /var/run/$prog
309-
310- [ ! -d /var/run/$agent ] && install -d -m 775 /var/run/$agent
311-
312- [ -n "$(which restorecon)" ] && \
313- [ -x "$(which restorecon)" ] && \
314- restorecon /var/run/$prog
315-
316- [ -n "$(which restorecon)" ] && \
317- [ -x "$(which restorecon)" ] && \
318- restorecon /var/run/$agent
319-
320- echo -n $"Starting $prog: "
321+ msg_starting "$prog"
322 daemon $prog $FENCESANLOCKDOPTS
323 retval=$?
324- echo
325 [ $retval -eq 0 ] && touch $lockfile
326 return $retval
327 }
328
329 stop() {
330+ if [ ! -f /var/lock/subsys/$prog ]; then
331+ msg_not_running "$prog"
332+ return
333+ fi
334 agent_ps="$(ps ax -o pid,args | grep fence_sanlock | grep -v grep | grep -v fence_sanlockd)"
335
336 [ -n "$agent_ps" ] && {
337 agent_pid="$(echo $agent_ps | awk '{print $1}')"
338- echo -n "cannot stop while $agent $agent_pid is running"
339- failure; echo
340- return 1
341+ echo "Cannot stop while $agent $agent_pid is running" >&2
342+ retval=1
343+ return $retval
344 }
345
346 # Ideally, we'd like a general way to check if anything
347@@ -78,17 +71,17 @@
348 if [ -d /sys/kernel/dlm/ ]; then
349 count="$(ls -A /sys/kernel/dlm/ | wc -l)"
350 if [ $count -ne 0 ]; then
351- echo -n "cannot stop while dlm lockspaces exist"
352- failure; echo
353- return 1
354+ echo "Cannot stop while dlm lockspaces exist" >&2
355+ retval=1
356+ return $retval
357 fi
358 fi
359
360 if [ -d /sys/kernel/config/dlm/cluster ]; then
361 # this dir exists while dlm_controld is running
362- echo -n "cannot stop while dlm is running"
363- failure; echo
364- return 1
365+ echo "Cannot stop while dlm is running" >&2
366+ retval=1
367+ return $retval
368 fi
369
370 PID=$(pidofproc -p $runfile $prog)
371@@ -96,10 +89,8 @@
372 # We have to use SIGHUP to mean stop because sanlock
373 # uses SIGTERM to mean that the lockspace failed.
374
375- echo -n $"Sending stop signal $prog ($PID): "
376 killproc -p $runfile $prog -HUP
377 retval=$?
378- echo
379
380 if [ $retval -ne 0 ]; then
381 return $retval
382@@ -113,75 +104,65 @@
383 echo "" > $fifofile
384 fi
385
386- echo -n $"Waiting for $prog ($PID) to stop:"
387+ show "Waiting for %s (%s) to stop:" "$prog" "$PID"
388
389 timeout=10
390 while checkpid $PID; do
391 sleep 1
392 timeout=$((timeout - 1))
393 if [ "$timeout" -le 0 ]; then
394- failure; echo
395+ fail
396 return 1
397 fi
398 done
399
400- success; echo
401+ ok
402 rm -f $lockfile
403
404 # stop wdmd and sanlock daemons if they are running
405-
406- service sanlock status > /dev/null 2>&1 && service sanlock stop
407-
408- service wdmd status > /dev/null 2>&1 && service wdmd stop
409+ /etc/rc.d/init.d/sanlock status >/dev/null 2>&1 && /etc/rc.d/init.d/sanlock stop
410+ /etc/rc.d/init.d/wdmd status >/dev/null 2>&1 && /etc/rc.d/init.d/wdmd stop
411
412 return $retval
413 }
414
c4ff6f07 415-restart() {
7140d736
JB
416- rh_status_q && stop
417- start
418-}
a9d7d0e7 419-
c4ff6f07
JB
420-reload() {
421- restart
422-}
423-
424-rh_status() {
425- status $prog
426-}
427-
428-rh_status_q() {
429- rh_status >/dev/null 2>&1
7140d736 430+condrestart() {
51fef094
JB
431+ if [ ! -f /var/lock/subsys/$prog ]; then
432+ msg_not_running "$prog"
7140d736 433+ retval=$1
51fef094 434+ return $retval
7140d736 435+ fi
51fef094
JB
436+ stop && start
437+ retval=$?
438+ return $retval
7140d736 439 }
51fef094
JB
440-
441+
c4ff6f07
JB
442 case "$1" in
443 start)
444- rh_status_q && exit 0
445- $1
446+ start
447 ;;
448 stop)
449- rh_status_q || exit 0
450- $1
451+ stop
452 ;;
453 restart)
454- $1
51fef094
JB
455+ stop && start
456 ;;
457 reload)
458 rh_status_q || exit 7
459 $1
c4ff6f07
JB
460 ;;
461 force-reload)
462- force_reload
463+ condrestart 7
464 ;;
51fef094 465 status)
c4ff6f07 466- rh_status
51fef094
JB
467+ status --pidfile $runfile $prog
468+ retval=$?
7140d736 469 ;;
51fef094 470 condrestart|try-restart)
c4ff6f07
JB
471- rh_status_q || exit 0
472- restart
51fef094 473+ condrestart 0
c4ff6f07
JB
474 ;;
475 *)
476- echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
51fef094
JB
477- exit 2
478+ msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
479+ exit 3
c4ff6f07 480 esac
51fef094 481 exit $?
This page took 0.7125 seconds and 4 git commands to generate.