]> git.pld-linux.org Git - packages/sanlock.git/blob - sanlock-init-pld.patch
- added init-pld patch to PLDify init scripts
[packages/sanlock.git] / sanlock-init-pld.patch
1 --- sanlock-2.0/init.d/sanlock.orig     2012-03-02 22:13:24.000000000 +0100
2 +++ sanlock-2.0/init.d/sanlock  2012-03-07 18:27:31.785530424 +0100
3 @@ -31,27 +31,24 @@
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 --user=$SANLOCKUSER $prog daemon $SANLOCKOPTS
21 -       retval=$?
22 -       echo
23 -       [ $retval -eq 0 ]
24 -       return $retval
25 +       RETVAL=$?
26 +       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sanlock
27  }
28  
29  stop() {
30 -       echo -n $"Stopping $prog: "
31 -       killproc -p $lockfile $prog -TERM
32 -       retval=$?
33 -       echo
34 -       [ $retval -eq 0 ]
35 +       if [ ! -f /var/lock/subsys/sanlock ]; then
36 +               msg_not_running "sanlock"
37 +               return
38 +       fi
39 +       killproc --pidfile $lockfile $prog
40 +       rm -f /var/lock/subsys/sanlock
41  }
42  
43  wait_for_stop() {
44 @@ -60,53 +57,45 @@
45         done
46  }
47  
48 -restart() {
49 +condrestart() {
50 +       if [ ! -f /var/lock/subsys/sanlock ]; then
51 +               msg_not_running "sanlock"
52 +               RETVAL=$1
53 +               return
54 +       fi
55         stop
56         wait_for_stop
57         start
58  }
59  
60 -reload() {
61 -       restart
62 -}
63 -
64 -rh_status() {
65 -       status $prog
66 -}
67 -
68 -rh_status_q() {
69 -       rh_status >/dev/null 2>&1
70 +restart() {
71 +       stop
72 +       wait_for_stop
73 +       start
74  }
75  
76  case "$1" in
77         start)
78 -               rh_status_q && exit 0
79 -               $1
80 +               start
81                 ;;
82         stop)
83 -               rh_status_q || exit 0
84 -               $1
85 +               stop
86                 ;;
87         restart)
88 -               $1
89 +               restart
90                 ;;
91 -       reload)
92 -               rh_status_q || exit 7
93 -               $1
94 +       try-restart)
95 +               condrestart 0
96                 ;;
97         force-reload)
98 -               force_reload
99 +               condrestart 7
100                 ;;
101         status)
102 -               rh_status
103 -               ;;
104 -       condrestart|try-restart)
105 -               rh_status_q || exit 0
106 -               restart
107 +               status --pidfile $pidfile sanlock
108 +               RETVAL=$?
109                 ;;
110         *)
111 -               echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
112 -               exit 2
113 +               msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
114 +               exit 3
115  esac
116 -exit $?
117 -
118 +exit $RETVAL
119 --- sanlock-2.0/init.d/wdmd.orig        2012-03-02 22:13:24.000000000 +0100
120 +++ sanlock-2.0/init.d/wdmd     2012-03-07 18:26:30.102195201 +0100
121 @@ -3,7 +3,7 @@
122  # wdmd - watchdog multiplexing daemon
123  #
124  # chkconfig: 2345 97 03
125 -# description: starts and stops sanlock daemon
126 +# description: starts and stops wdmd daemon
127  #
128  
129  
130 @@ -22,7 +22,7 @@
131  . /etc/rc.d/init.d/functions
132  
133  prog="wdmd"
134 -lockfile="/var/run/$prog/$prog.pid"
135 +pidfile="/var/run/$prog/$prog.pid"
136  exec="/usr/sbin/$prog"
137  
138  WDMDGROUP="sanlock"
139 @@ -31,75 +31,58 @@
140  [ -f /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
141  
142  start() {
143 -       [ -x $exec ] || exit 5
144 -
145 -       if [ ! -d /var/run/$prog ]; then
146 -               mkdir -p /var/run/$prog
147 -               [ -x /sbin/restorecon ] && restorecon /var/run/$prog
148 +       # Check if the service is already running?
149 +       if [ -f /var/lock/subsys/wdmd ]; then
150 +               msg_already_running "wdmd"
151 +               return
152         fi
153 -
154 -       echo -n $"Starting $prog: "
155 +       msg_starting "wdmd"
156         daemon $prog $WDMDOPTS
157 -       retval=$?
158 -       echo
159 -       [ $retval -eq 0 ] && touch $lockfile
160 -       return $retval
161 +       RETVAL=$?
162 +       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/wdmd
163  }
164  
165  stop() {
166 -       echo -n $"Stopping $prog: "
167 -       killproc -p $lockfile $prog -TERM
168 -       retval=$?
169 -       echo
170 -       [ $retval -eq 0 ] && rm -f $lockfile
171 +       if [ ! -f /var/lock/subsys/wdmd ]; then
172 +               msg_not_running "wdmd"
173 +               return
174 +       fi
175 +       killproc --pidfile $pidfile $prog
176 +       rm -f /var/lock/subsys/wdmd
177  }
178  
179 -restart() {
180 +condrestart() {
181 +       if [ ! -f /var/lock/subsys/wdmd ]; then
182 +               msg_not_running "wdmd"
183 +               RETVAL=$1
184 +               return
185 +       fi
186         stop
187         start
188  }
189  
190 -reload() {
191 -       restart
192 -}
193 -
194 -rh_status() {
195 -       status $prog
196 -}
197 -
198 -rh_status_q() {
199 -       rh_status >/dev/null 2>&1
200 -}
201 -
202  case "$1" in
203         start)
204 -               rh_status_q && exit 0
205 -               $1
206 +               start
207                 ;;
208         stop)
209 -               rh_status_q || exit 0
210 -               $1
211 +               stop
212                 ;;
213         restart)
214 -               $1
215 +               stop
216 +               start
217                 ;;
218 -       reload)
219 -               rh_status_q || exit 7
220 -               $1
221 +       try-restart)
222 +               condrestart 0
223                 ;;
224         force-reload)
225 -               force_reload
226 +               condrestart 7
227                 ;;
228         status)
229 -               rh_status
230 -               ;;
231 -       condrestart|try-restart)
232 -               rh_status_q || exit 0
233 -               restart
234 +               status --pidfile $pidfile wdmd
235                 ;;
236         *)
237 -               echo $"Usage $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
238 -               exit 2
239 +               msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
240 +               exit 3
241  esac
242 -exit $?
243 -
244 +exit $RETVAL
This page took 0.111839 seconds and 3 git commands to generate.