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