Change initialization order for logsys logging to files to work properly.
[openais.git] / init / generic
blobe30ad6f2490e416b9dab2572f13f2c6f38e0f241
1 #!/bin/sh
3 # openais Start the openais cluster service
5 # Author: Andrew Beekhof <abeekhof@suse.de>
6 # License: Revised BSD
8 # chkconfig: - 20 20
9 # processname: aisexec
10 # description: OpenAIS daemon
12 ### BEGIN INIT INFO
13 # Description: openais....
15 # Short-Description: openais cluster services.
16 # Provides: openais
17 # Required-Start: $network
18 # Should-Start: $syslog
19 # Required-Stop: $network
20 # Default-Start: 3 5
21 # Default-Stop: 0 6
22 ### END INIT INFO
24 do_force=0
25 prog="aisexec"
26 lockfile="/var/lock/subsys/$prog"
28 internal_status() {
29 killall -0 aisexec > /dev/null 2>&1
30 return $?
33 status() {
34 if
35 ! internal_status
36 then
37 echo "Stopped"
38 return 7
41 echo "Running"
42 return 0
45 start() {
46 echo -n $"Starting OpenAIS daemon ($prog): "
47 if
48 ! internal_status
49 then
50 echo -n "starting... "
51 $prog 2>&1 > /dev/null 2>&1
52 echo -n "rc=$?: "
55 sleep 2 # give it time to fail... $? isn't definitive
57 if
58 internal_status
59 then
60 echo "OK"
61 return 0
64 echo "Failed"
65 return 1
68 do_force=0
69 do_forever=1
71 stop() {
72 echo -n $"Stopping OpenAIS daemon ($prog): "
74 killall -QUIT aisexec
76 if [ $do_forever = 0 ]; then
77 for i in 1 2 3 4 5 6 7 8 9 10 12 13 14 15 16 17 18 19 20; do
79 internal_status
80 then
81 sleep 2
82 echo -n "."
83 else
84 rm -f "$lockfile"
85 echo "OK"
86 return 0
88 done
90 if [ $do_force = 1 ]; then
91 echo -n "Escalating... "
92 killall -KILL aisexec
93 sleep 5
96 ! internal_status
97 then
98 rm -f "$lockfile"
99 echo "OK"
100 return 0
104 echo "Failed"
105 return 1
108 while
109 internal_status
111 sleep 1
112 echo -n "."
113 done
115 rm -f "$lockfile"
116 echo "OK"
117 return 0
120 restart() {
121 stop
122 start
125 case "$1" in
126 start|stop|restart)
129 force-stop)
130 do_force=1
131 stop
133 reload|force-reload)
134 restart
136 condrestart|try-restart)
137 [ ! -f "$lockfile" ] || restart
139 status)
140 status $prog
143 echo $"Usage: $0 {start|stop|restart|try-restart|condrestart|reload|force-reload|force-stop|status}"
144 exit 2
145 esac