]> git.pld-linux.org Git - packages/sanlock.git/blob - sanlock-init-pld.patch
- updated to 3.2.4
[packages/sanlock.git] / sanlock-init-pld.patch
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 @@
4  [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
5  
6  start() {
7 -       [ -x $exec ] || exit 5
8 -
9 -       if [ ! -d /var/run/$prog ]; then
10 -               install -d -o $SANLOCKUSER -g $SANLOCKUSER -m 775 /var/run/$prog
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
17  
18 -       echo -n $"Starting $prog: "
19 +       msg_starting "sanlock"
20         daemon $prog daemon $SANLOCKOPTS
21         retval=$?
22 -       echo
23         [ $retval -eq 0 ] && touch $lockfile
24         return $retval
25  }
26  
27  stop() {
28 +       if [ ! -f /var/lock/subsys/sanlock ]; then
29 +               msg_not_running "sanlock"
30 +               return
31 +       fi
32         PID=$(pidofproc -p $runfile $prog)
33  
34 -       echo -n $"Sending stop signal $prog ($PID): "
35         killproc -p $runfile $prog -TERM
36         retval=$?
37 -       echo
38  
39         if [ $retval -ne 0 ]; then
40                 return $retval
41         fi
42  
43 -       echo -n $"Waiting for $prog ($PID) to stop:"
44 +       show "Waiting for %s (%s) to stop:" "$prog" "$PID"
45 +       busy
46  
47         timeout=10
48         while checkpid $PID; do
49                 sleep 1
50                 timeout=$((timeout - 1))
51                 if [ "$timeout" -le 0 ]; then
52 -                       failure; echo
53 -                       return 1
54 +                       fail
55 +                       retval=1
56 +                       return $retval
57                 fi
58         done
59  
60 -       success; echo
61 +       ok
62         rm -f $lockfile
63         return $retval
64  }
65  
66 -restart() {
67 -       rh_status_q && stop
68 -       start
69 -}
70 -
71 -reload() {
72 -       restart
73 -}
74 -
75 -rh_status() {
76 -       status $prog
77 -}
78 -
79 -rh_status_q() {
80 -       rh_status >/dev/null 2>&1
81 +condrestart() {
82 +       if [ ! -f /var/lock/subsys/sanlock ]; then
83 +               msg_not_running "sanlock"
84 +               retval=$1
85 +               return $retval
86 +       fi
87 +       stop && start
88 +       retval=$?
89 +       return $retval
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
105 +               stop
106 +               start
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
124 +               status --pidfile $runfile sanlock
125 +               retval=$?
126                 ;;
127         *)
128 -               echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
129 -               exit 2
130 +               msg_usage "$0 {start|stop|status|restart||try-restart|force-reload}"
131 +               exit 3
132  esac
133 -exit $?
134 +exit $retval
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=$?
139  
140         if [ $retval -ne 0 ]; then
141 -               echo -n $"Loading the softdog kernel module: "
142 +               show "Loading the softdog kernel module: "
143                 modprobe softdog && udevadm settle
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
154         fi
155  }
156  
157  start() {
158 +       # Check if the service is already running?
159 +       if [ -f $lockfile ]; then
160 +               msg_already_running "wdmd"
161 +               return
162 +       fi
163
164         watchdog_check
165  
166         [ -x $exec ] || exit 5
167  
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 -
173 -       echo -n $"Starting $prog: "
174 +       msg_starting "wdmd"
175         daemon $prog $WDMDOPTS
176         retval=$?
177 -       echo
178         [ $retval -eq 0 ] && touch $lockfile
179         return $retval
180  }
181  
182  stop() {
183 +       if [ ! -f $lockfile ]; then
184 +               msg_not_running "wdmd"
185 +               return
186 +       fi
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
218  }
219  
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  
415 -restart() {
416 -       rh_status_q && stop
417 -       start
418 -}
419 -
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
430 +condrestart() {
431 +       if [ ! -f /var/lock/subsys/$prog ]; then
432 +               msg_not_running "$prog"
433 +               retval=$1
434 +               return $retval
435 +       fi
436 +       stop && start
437 +       retval=$?
438 +       return $retval
439  }
440 -
441
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
455 +               stop && start
456                 ;;
457         reload)
458                 rh_status_q || exit 7
459                 $1
460                 ;;
461         force-reload)
462 -               force_reload
463 +               condrestart 7
464                 ;;
465         status)
466 -               rh_status
467 +               status --pidfile $runfile $prog
468 +               retval=$?
469                 ;;
470         condrestart|try-restart)
471 -               rh_status_q || exit 0
472 -               restart
473 +               condrestart 0
474                 ;;
475         *)
476 -               echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
477 -               exit 2
478 +               msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
479 +               exit 3
480  esac
481  exit $?
This page took 0.47185 seconds and 4 git commands to generate.