]> TLD Linux GIT Repositories - packages/lvm2.git/blob - lvm2-tld_init.patch
- updated to 2.02.181
[packages/lvm2.git] / lvm2-tld_init.patch
1 diff -urp LVM2.2.02.177.orig/scripts/blk_availability_init_red_hat.in LVM2.2.02.177/scripts/blk_availability_init_red_hat.in
2 --- LVM2.2.02.177.orig/scripts/blk_availability_init_red_hat.in 2017-12-18 20:44:35.000000000 +0000
3 +++ LVM2.2.02.177/scripts/blk_availability_init_red_hat.in      2018-01-29 11:24:46.012906501 +0000
4 @@ -1,4 +1,4 @@
5 -#!/bin/bash
6 +#!/bin/sh
7  #
8  # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
9  #
10 @@ -31,26 +31,29 @@
11  
12  . /etc/init.d/functions
13  
14 -script=blkdeactivate
15 +DAEMON="blkdeactivate"
16 +OPTIONS="-u -l wholevg -m disablequeueing"
17  
18 -sbindir=@SBINDIR@
19 -options="-u -l wholevg -m disablequeueing -r wait"
20 -
21 -LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
22 +LOCK_FILE="/var/lock/subsys/blk-availability"
23  
24  case "$1" in
25    start)
26         touch "$LOCK_FILE"
27 +       exit 0
28         ;;
29  
30    stop)
31 -       action "Stopping block device availability:" "$sbindir/$script" $options
32 +       run_cmd "Stopping block device availability:" "/sbin/$DAEMON" $OPTIONS
33         rm -f "$LOCK_FILE"
34 +       exit 0
35         ;;
36  
37    status)
38 +       exit 0
39         ;;
40 +
41    *)
42 -       echo $"Usage: $0 {start|stop|status}"
43 +       msg_usage "$0 {start|stop|status}"
44 +       exit 3
45         ;;
46  esac
47 diff -urp LVM2.2.02.177.orig/scripts/clvmd_init_red_hat.in LVM2.2.02.177/scripts/clvmd_init_red_hat.in
48 --- LVM2.2.02.177.orig/scripts/clvmd_init_red_hat.in    2017-12-18 20:44:35.000000000 +0000
49 +++ LVM2.2.02.177/scripts/clvmd_init_red_hat.in 2018-01-29 12:54:59.156583852 +0000
50 @@ -4,7 +4,7 @@
51  #
52  # chkconfig: - 24 76
53  # description: Cluster daemon for userland logical volume management tools.
54 -# pidfile: @CLVMD_PIDFILE@
55 +# pidfile: /var/run/clvmd.pid
56  #
57  # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
58  #
59 @@ -18,15 +18,12 @@
60  
61  . /etc/rc.d/init.d/functions
62  
63 -DAEMON=clvmd
64 +DAEMON="clvmd"
65  
66 -sbindir="@SBINDIR@"
67 -usrsbindir="@USRSBINDIR@"
68 -
69 -lvm_vgchange="$sbindir/vgchange"
70 -lvm_vgs="$sbindir/vgs"
71 -lvm_vgscan="$sbindir/vgscan"
72 -lvm_lvs="$sbindir/lvs"
73 +lvm_vgchange="/sbin/vgchange"
74 +lvm_vgs="/sbin/vgs"
75 +lvm_vgscan="/sbin/vgscan"
76 +lvm_lvs="/sbin/lvs"
77  
78  CLVMDOPTS="-T30"
79  
80 @@ -50,20 +47,11 @@ clustered_active_lvs() {
81         "$lvm_lvs" --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
82  }
83  
84 -rh_status() {
85 -       status "$DAEMON"
86 -}
87 -
88 -rh_status_q() {
89 -       rh_status >/dev/null 2>&1
90 -}
91 -
92  start()
93  {
94 -       if ! rh_status_q; then
95 -               echo -n "Starting $DAEMON: "
96 -               "$usrsbindir/$DAEMON" $CLVMDOPTS || return $?
97 -               echo
98 +       if ! status $DAEMON 1>/dev/null 2>&1; then
99 +               msg_starting "$DAEMON"
100 +               "$DAEMON" $CLVMDOPTS || return $?
101         fi
102  
103         # Refresh local cache.
104 @@ -82,74 +70,60 @@ start()
105         # unnecessary warnings.
106  
107         "$lvm_vgscan" > /dev/null 2>&1
108 -
109 -       action "Activating VG(s):" "$lvm_vgchange" -aay $LVM_VGS || return $?
110 -
111 +       run_cmd "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $?
112         touch "$LOCK_FILE"
113 -
114         return 0
115  }
116  
117  wait_for_finish()
118  {
119         count=0
120 -       while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && \
121 -                rh_status_q ]; do
122 +       while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && status $DAEMON 1>/dev/null 2>&1 ; do
123                 sleep 1
124                 count=$((count+1))
125         done
126 -
127 -       ! rh_status_q
128 +       ! status $DAEMON 1>/dev/null 2>&1
129  }
130  
131  stop()
132  {
133 -       rh_status_q || return 0
134 -
135 +       status $DAEMON 1>/dev/null 2>&1 || return 0
136         [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
137         if [ -n "$LVM_VGS" ]; then
138 -               action "Deactivating clustered VG(s):" "$lvm_vgchange" -anl $LVM_VGS || return $?
139 +               run_cmd "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $?
140         fi
141 -
142 -       action "Signaling $DAEMON to exit" kill -TERM "$(pidofproc "$DAEMON")" || return $?
143 +       run_cmd "Signaling $DAEMON to exit" kill -TERM $(pidofproc "$DAEMON") || return $?
144  
145         # wait half second before we start the waiting loop or we will show
146         # the loop more time than really necessary
147         usleep 500000
148  
149         # clvmd could take some time to stop
150 -       rh_status_q && action "Waiting for $DAEMON to exit:" wait_for_finish
151 -
152 -       if rh_status_q; then
153 -               echo -n "$DAEMON failed to exit"
154 -               failure
155 -               echo
156 +       status $DAEMON 1>/dev/null 2>&1 && run_cmd "Waiting for $DAEMON to exit:" wait_for_finish
157 +       if status $DAEMON 1>/dev/null 2>&1; then
158 +               fail
159                 return 1
160         else
161 -               echo -n "$DAEMON terminated"
162 -               success
163 -               echo
164 +               ok
165         fi
166 -
167         rm -f "$LOCK_FILE"
168 -
169         return 0
170  }
171  
172  reload() {
173 -       rh_status_q || exit 7
174 -       action "Reloading $DAEMON configuration: " "$usrsbindir/$DAEMON" -R || return $?
175 +       status $DAEMON 1>/dev/null 2>&1 || exit 7
176 +       run_cmd "Reloading $DAEMON configuration: " "$DAEMON" -R || return $?
177  }
178  
179  restart() {
180         # if stop fails, restart will return the error and not attempt
181 -       # another start. Even if start is protected by rh_status_q,
182 +       # another start. Even if start is protected by status call,
183         # that would avoid spawning another daemon, it would try to
184         # reactivate the VGs.
185  
186         # Try to get clvmd to restart itself. This will preserve 
187         # exclusive LV locks
188 -       action "Restarting $DAEMON: " "$usrsbindir/$DAEMON" -S
189 +       run_cmd "Restarting $DAEMON: " "$DAEMON" -S
190  
191         # If that fails then do a normal stop & restart
192         if  [ $? != 0 ]; then
193 @@ -166,38 +140,39 @@ restart() {
194         exit 4
195  }
196  
197 +RETVAL=0
198  # See how we were called.
199  case "$1" in
200    start)
201         start
202 -       rtrn=$?
203 +       RETVAL=$?
204         ;;
205  
206    stop)
207         stop
208 -       rtrn=$?
209 +       RETVAL=$?
210         ;;
211  
212    restart|force-reload)
213         restart
214 -       rtrn=$?
215 +       RETVAL=$?
216         ;;
217  
218    condrestart|try-restart)
219 -       rh_status_q || exit 0
220 +       status $DAEMON 1>/dev/null 2>&1 || exit 0
221         restart
222 -       rtrn=$? 
223 +       RETVAL=$?
224         ;;
225  
226    reload)
227         reload
228 -       rtrn=$?
229 +       RETVAL=$?
230         ;;
231  
232    status)
233 -       rh_status
234 -       rtrn=$?
235 -       if [ "$rtrn" = 0 ]; then
236 +       status $DAEMON
237 +       RETVAL=$?
238 +       if [ $RETVAL = 0 ]; then
239                 cvgs="$(clustered_vgs)"
240                 echo Clustered Volume Groups: ${cvgs:-"(none)"}
241                 clvs="$(clustered_active_lvs)"
242 @@ -206,9 +181,9 @@ case "$1" in
243         ;;
244  
245    *)
246 -       echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
247 -       rtrn=2
248 +       msg_usage "$0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
249 +       RETVAL=2
250         ;;
251  esac
252  
253 -exit $rtrn
254 +exit $RETVAL
255 diff -urp LVM2.2.02.177.orig/scripts/cmirrord_init_red_hat.in LVM2.2.02.177/scripts/cmirrord_init_red_hat.in
256 --- LVM2.2.02.177.orig/scripts/cmirrord_init_red_hat.in 2017-12-18 20:44:35.000000000 +0000
257 +++ LVM2.2.02.177/scripts/cmirrord_init_red_hat.in      2018-01-29 11:28:49.069892013 +0000
258 @@ -2,7 +2,7 @@
259  #
260  # chkconfig: - 22 78
261  # description: Starts and stops cmirrord
262 -# pidfile: @CMIRRORD_PIDFILE@
263 +# pidfile: /var/run/cmirrord.pid
264  #
265  # For Red-Hat-based distributions such as Fedora, RHEL, CentOS.
266  #
267 @@ -16,95 +16,57 @@
268  
269  . /etc/init.d/functions
270  
271 -DAEMON=cmirrord
272 +DAEMON="cmirrord"
273  
274 -usrsbindir="@USRSBINDIR@"
275 -
276 -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
277 +LOCK_FILE="/var/lock/subsys/$DAEMON"
278  
279  start()
280  {
281 -       rtrn=0
282 -       if ! pidof "$DAEMON" > /dev/null
283 -       then
284 -               echo -n "Starting $DAEMON: "
285 -               daemon "$usrsbindir/$DAEMON"
286 -               rtrn=$?
287 -               echo
288 -       fi
289 -
290 -       return $rtrn
291 +        if [ -f $LOCK_FILE ]; then
292 +                msg_already_running "$DAEMON"
293 +                return
294 +        fi
295 +        msg_starting "$DAEMON"
296 +        daemon /sbin/$DAEMON </dev/null
297 +        RETVAL=$?
298 +        [ $RETVAL -eq 0 ] && touch "$LOCK_FILE"
299  }
300  
301  stop()
302  {
303 -       echo -n "Stopping $DAEMON:"
304 -       killproc "$DAEMON" -TERM
305 -       rtrn=$?
306 -       echo
307 -
308 -       return $rtrn
309 -}
310 -
311 -wait_for_finish()
312 -{
313 -       count=0
314 -
315 -       while [ "$count" -le 10 -a -n "`pidof $DAEMON`" ]
316 -       do
317 -               sleep 1
318 -               count=$((count + 1))
319 -       done
320 -
321 -       if [ "$(pidof "$DAEMON")" ]
322 -       then
323 -               return 1
324 -       else
325 -               return 0
326 +       if [ ! -f $LOCK_FILE ]; then
327 +               msg_not_running "$DAEMON"
328 +               return
329         fi
330 +       msg_stopping "$DAEMON"
331 +       killproc --pidfile "$PID_FILE" "$DAEMON"
332 +       rm -f "$LOCK_FILE"
333  }
334  
335 -cmirror_status()
336 -{
337 -       status "$DAEMON"
338 -}
339 -
340 -rtrn=1
341 -
342 +RETVAL=0
343  # See how we were called.
344  case "$1" in
345         start)
346                 start
347 -               rtrn=$?
348 -               [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
349                 ;;
350  
351         stop)
352                 stop
353 -               rtrn=$?
354 -               [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
355                 ;;
356  
357         restart)
358 -               if stop
359 -               then
360 -                       wait_for_finish
361 -                       start
362 -               fi
363 -               rtrn=$?
364 +               stop
365 +               start
366                 ;;
367  
368         status)
369 -               cmirror_status
370 -               rtrn=$?
371 -               if [ "$rtrn" -eq 0 ]; then
372 -                       echo "cmirror is running."
373 -               fi
374 +               status $DAEMON
375 +               exit $?
376                 ;;
377  
378         *)
379 -               echo $"Usage: $0 {start|stop|restart|status}"
380 +               msg_usage "$0 {start|stop|restart|status}"
381                 ;;
382  esac
383  
384 -exit $rtrn
385 +exit $RETVAL
386 diff -urp LVM2.2.02.177.orig/scripts/lvm2_lvmetad_init_red_hat.in LVM2.2.02.177/scripts/lvm2_lvmetad_init_red_hat.in
387 --- LVM2.2.02.177.orig/scripts/lvm2_lvmetad_init_red_hat.in     2017-12-18 20:44:35.000000000 +0000
388 +++ LVM2.2.02.177/scripts/lvm2_lvmetad_init_red_hat.in  2018-01-29 11:30:04.229887533 +0000
389 @@ -1,4 +1,4 @@
390 -#!/bin/bash
391 +#!/bin/sh
392  #
393  # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
394  #
395 @@ -33,78 +33,84 @@
396  
397  . /etc/init.d/functions
398  
399 -DAEMON=lvmetad
400 +DAEMON="lvmetad"
401 +NAME="LVM metadata daemon"
402  
403 -sbindir="@SBINDIR@"
404 -
405 -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
406 -PID_FILE="@LVMETAD_PIDFILE@"
407 -
408 -rh_status() {
409 -       status -p "$PID_FILE" "$DAEMON"
410 -}
411 -
412 -rh_status_q() {
413 -       rh_status >/dev/null 2>&1
414 -}
415 +LOCK_FILE="/var/lock/subsys/lvm2-lvmetad"
416 +PID_FILE="/var/run/lvmetad.pid"
417  
418  start()
419  {
420 -       ret=0
421 -       action "Starting LVM metadata daemon:" "$sbindir/$DAEMON" || ret=$?
422 -       return $ret
423 +       if [ -f "$LOCK_FILE" ]; then
424 +               msg_already_running "$NAME"
425 +               return
426 +       fi
427 +       msg_starting "$NAME"
428 +       daemon "/sbin/$DAEMON" </dev/null
429 +       RETVAL=$?
430 +       [ "$RETVAL" -eq 0 ] && touch "$LOCK_FILE"
431  }
432  
433  stop()
434  {
435 -       ret=0
436 -       action "Signaling LVM metadata daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
437 -       return $ret
438 +       if [ ! -f "$LOCK_FILE" ]; then
439 +               msg_not_running "$NAME"
440 +               return
441 +       fi
442 +       msg_stopping "$NAME"
443 +       killproc --pidfile "$PID_FILE" "$DAEMON"
444 +       rm -f "$LOCK_FILE"
445 +}
446 +
447 +condrestart() {
448 +       if [ ! -f "$LOCK_FILE" ]; then
449 +               msg_not_running "$NAME"
450 +               RETVAL=$1
451 +               return
452 +       fi
453 +       stop
454 +       start
455  }
456  
457 -rtrn=1
458 +reload() {
459 +       if [ ! -f "$LOCK_FILE" ]; then
460 +               msg_not_running "$NAME"
461 +               RETVAL=7
462 +               return
463 +       fi
464 +       msg_reloading "$NAME"
465 +       killproc "$DAEMON" -HUP
466 +       RETVAL=$?
467 +}
468  
469 +RETVAL=0
470  # See how we were called.
471  case "$1" in
472    start)
473 -       rh_status_q && exit 0
474         start
475 -       rtrn=$?
476 -       [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
477         ;;
478  
479 -  stop|force-stop)
480 -       rh_status_q || exit 0
481 +  stop)
482         stop
483 -       rtrn=$?
484 -       [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
485         ;;
486  
487    restart)
488 -       if stop
489 -       then
490 -               start
491 -       fi
492 -       rtrn=$?
493 +       stop
494 +       start
495         ;;
496  
497    condrestart|try-restart)
498 -       rh_status_q || exit 0
499 -       if stop
500 -       then
501 -               start
502 -       fi
503 -       rtrn=$?
504 +       condrestart 0
505         ;;
506  
507    status)
508 -       rh_status
509 -       rtrn=$?
510 +       status $DAEMON
511 +       exit $?
512         ;;
513  
514    *)
515 -       echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
516 +       msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
517         ;;
518  esac
519  
520 -exit $rtrn
521 +exit $RETVAL
522 diff -urp LVM2.2.02.177.orig/scripts/lvm2_lvmpolld_init_red_hat.in LVM2.2.02.177/scripts/lvm2_lvmpolld_init_red_hat.in
523 --- LVM2.2.02.177.orig/scripts/lvm2_lvmpolld_init_red_hat.in    2017-12-18 20:44:35.000000000 +0000
524 +++ LVM2.2.02.177/scripts/lvm2_lvmpolld_init_red_hat.in 2018-01-29 11:31:12.405883470 +0000
525 @@ -1,6 +1,6 @@
526 -#!/bin/bash
527 +#!/bin/sh
528  #
529 -# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
530 +# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
531  #
532  # This copyrighted material is made available to anyone wishing to use,
533  # modify, copy, or redistribute it subject to the terms and conditions
534 @@ -27,86 +27,92 @@
535  # Default-Start: 1 2 3 4 5
536  # Default-Stop: 0 6
537  # Short-Description: A daemon that is responsible for monitoring in-progress
538 -#                   and possibly longer term operations on logical volumes. 
539 -#                   It helps to reduce the number of spawned processes if same
540 +#                    and possibly longer term operations on logical volumes. 
541 +#                    It helps to reduce the number of spawned processes if same
542  #                    logical volume is requested to get monitored multiple times.
543  #                    Also avoids unsolicited termination due to external factors.
544  ### END INIT INFO
545  
546  . /etc/init.d/functions
547  
548 -DAEMON=lvmpolld
549 +DAEMON="lvmpolld"
550 +NAME="LVM poll daemon"
551  
552 -sbindir="@SBINDIR@"
553 -
554 -LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
555 -PID_FILE="@LVMPOLLD_PIDFILE@"
556 -
557 -rh_status() {
558 -       status -p "$PID_FILE" "$DAEMON"
559 -}
560 -
561 -rh_status_q() {
562 -       rh_status >/dev/null 2>&1
563 -}
564 +LOCK_FILE="/var/lock/subsys/lvm2-lvmpolld"
565 +PID_FILE="/var/run/lvmpolld.pid"
566  
567  start()
568  {
569 -       ret=0
570 -       action "Starting LVM poll daemon:" "$sbindir/$DAEMON" || ret=$?
571 -       return $ret
572 +       if [ -f $LOCK_FILE ]; then
573 +               msg_already_running "$NAME"
574 +               return
575 +       fi
576 +       msg_starting "$NAME"
577 +       daemon "/sbin/$DAEMON" </dev/null
578 +       RETVAL=$?
579 +       [ "$RETVAL" -eq 0 ] && touch "$LOCK_FILE"
580  }
581  
582  stop()
583  {
584 -       ret=0
585 -       action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
586 -       return "$ret"
587 +       if [ ! -f "$LOCK_FILE" ]; then
588 +               msg_not_running "$NAME"
589 +               return
590 +       fi
591 +       msg_stopping "$NAME"
592 +       killproc --pidfile "$PID_FILE" "$DAEMON"
593 +       rm -f "$LOCK_FILE"
594 +}
595 +
596 +condrestart() {
597 +       if [ ! -f "$LOCK_FILE" ]; then
598 +               msg_not_running "$NAME"
599 +               RETVAL=$1
600 +               return
601 +       fi
602 +       stop
603 +       start
604  }
605  
606 -rtrn=1
607 +reload() {
608 +       if [ ! -f "$LOCK_FILE" ]; then
609 +               msg_not_running "$NAME"
610 +               RETVAL=7
611 +               return
612 +       fi
613 +       msg_reloading "$NAME"
614 +       killproc "$DAEMON" -HUP
615 +       RETVAL=$?
616 +}
617  
618 +RETVAL=0
619  # See how we were called.
620  case "$1" in
621    start)
622 -       rh_status_q && exit 0
623         start
624 -       rtrn=$?
625 -       [ $rtrn = 0 ] && touch "$LOCK_FILE"
626         ;;
627  
628 -  stop|force-stop)
629 -       rh_status_q || exit 0
630 +  stop)
631         stop
632 -       rtrn=$?
633 -       [ $rtrn = 0 ] && rm -f "$LOCK_FILE"
634         ;;
635  
636    restart)
637 -       if stop
638 -       then
639 -               start
640 -       fi
641 -       rtrn=$?
642 +       stop
643 +       start
644         ;;
645  
646    condrestart|try-restart)
647 -       rh_status_q || exit 0
648 -       if stop
649 -       then
650 -               start
651 -       fi
652 -       rtrn=$?
653 +       condrestart 0
654         ;;
655  
656    status)
657 -       rh_status
658 -       rtrn=$?
659 +       status $DAEMON
660 +       exit $?
661         ;;
662  
663    *)
664 -       echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
665 +       msg_usage "$0 {start|stop|force-stop|restart|condrestart|try-restart|status}"
666         ;;
667  esac
668  
669 -exit $rtrn
670 +exit $RETVAL
671 diff -urp LVM2.2.02.177.orig/scripts/lvm2_monitoring_init_red_hat.in LVM2.2.02.177/scripts/lvm2_monitoring_init_red_hat.in
672 --- LVM2.2.02.177.orig/scripts/lvm2_monitoring_init_red_hat.in  2017-12-18 20:44:35.000000000 +0000
673 +++ LVM2.2.02.177/scripts/lvm2_monitoring_init_red_hat.in       2018-01-29 11:33:20.925875809 +0000
674 @@ -1,4 +1,4 @@
675 -#!/bin/bash
676 +#!/bin/sh
677  #
678  # Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
679  #
680 @@ -31,104 +31,92 @@
681  
682  . /etc/init.d/functions
683  
684 -DAEMON=lvm2-monitor
685 -DMEVENTD_DAEMON=dmeventd
686 +DAEMON="lvm2-monitor"
687 +DMEVENTD_DAEMON="dmeventd"
688  
689 -sbindir=@SBINDIR@
690 +VGCHANGE="/sbin/vgchange"
691 +VGS="/sbin/vgs"
692 +LVS="/sbin/lvs"
693  
694 -VGCHANGE="$sbindir/vgchange"
695 -VGS="$sbindir/vgs"
696 -LVS="$sbindir/lvs"
697 -
698 -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
699 -PID_FILE="@DMEVENTD_PIDFILE@"
700 +LOCK_FILE="/var/lock/subsys/$DAEMON"
701 +PID_FILE="/var/run/dmeventd.pid"
702  
703  WARN=1
704  export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
705  
706 -rh_status() {
707 -       status -p "$PID_FILE" "$DMEVENTD_DAEMON"
708 -}
709 -
710 -rh_status_q() {
711 -       rh_status >/dev/null 2>&1
712 -}
713  start()
714  {
715 -       ret=0
716 +       local config="'log{command_names=0 prefix=\"  \"}'"
717         # TODO do we want to separate out already active groups only?
718 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
719 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config $config 2> /dev/null`
720         for vg in $VGSLIST
721         do
722 -           action "Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
723 +               run_cmd "Starting monitoring for LVM VG $vg" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config $config $vg
724         done
725 -
726 -       return $ret
727  }
728  
729  
730  stop()
731  {
732 -       ret=0
733 +       local config="'log{command_names=0 prefix=\"  \"}'"
734         # TODO do we want to separate out already active groups only?
735         if test "$WARN" = "1"; then
736            echo "Not stopping monitoring, this is a dangerous operation. Please use force-stop to override."
737            return 1
738         fi
739 -       VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' 2> /dev/null`
740 +       VGSLIST=`eval $VGS --noheadings -o name --ignoreskippedcluster --config ${config} 2> /dev/null`
741         for vg in $VGSLIST
742         do
743 -           action "Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix="  "}' $vg || ret=$?
744 +               run_cmd "Stopping monitoring for LVM VG $vg" $VGCHANGE --monitor n --ignoreskippedcluster --config $config $vg
745         done
746 -       return $ret
747  }
748  
749 -rtrn=1
750 -
751 +RETVAL=0
752  # See how we were called.
753  case "$1" in
754    start)
755 -       rh_status_q && exit 0
756 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 && exit 0
757         start
758 -       rtrn=$?
759 -       [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
760 +       RETVAL=$?
761 +       [ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
762         ;;
763  
764    force-stop)
765 -       rh_status_q || exit 0
766 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
767         WARN=0
768         stop
769 -       rtrn=$?
770 -       [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
771 +       RETVAL=$?
772 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
773         ;;
774  
775    stop)
776 -       rh_status_q || exit 0
777 +       status "$DMEVENTD_DAEMON" 1>/dev/null 2>&1 || exit 0
778         test "$runlevel" = "0" && WARN=0
779         test "$runlevel" = "6" && WARN=0
780         stop
781 -       rtrn=$?
782 -       [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
783 +       RETVAL=$?
784 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
785         ;;
786  
787    restart)
788         WARN=0
789 -       if stop
790 -       then
791 -               start
792 -       fi 
793 -       rtrn=$?
794 +       stop
795 +       RETVAL=$?
796 +       [ "$RETVAL" = 0 ] && rm -f "$LOCK_FILE"
797 +       start
798 +       RETVAL=$?
799 +       [ "$RETVAL" = 0 ] && touch "$LOCK_FILE"
800         ;;
801  
802    status)
803 -       rh_status
804 -       rtrn=$?
805 -       [ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
806 +       status "$DMEVENTD_DAEMON"
807 +       RETVAL=$?
808 +       [ "$RETVAL" = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
809         ;;
810  
811    *)
812 -       echo $"Usage: $0 {start|stop|restart|status|force-stop}"
813 +       msg_usage "$0 {start|stop|restart|status|force-stop}"
814         ;;
815  esac
816  
817 -exit $rtrn
818 +exit $RETVAL