Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / rpmbuild / ace-tao-init-suse / init.d / tao-cosevent
blobd1822fc9b0a19b770f55fd62e8e481514c0d7c3c
1 #!/bin/bash
3 # chkconfig: - 81 14
4 # description: Starts and stops the TAO CosEvent Service.
5 # processname: tao-cosevent
6 # config: /etc/tao/tao-cosevent.opt
7 # config: /etc/tao/tao-cosevent.conf
8 # pidfile: /var/run/tao-cosevent.pid
9 # /etc/init.d/TAO-cosevent
10 # and its symbolic link
11 # /(usr/)sbin/rcTAO-cosevent
13 # system startup script for service/daemon TAO-cosconcurrency
15 # LSB compatible service control script; see http://www.linuxbase.org/spec/
17 ### BEGIN INIT INFO
18 # Provides: TAO-cosconcurrency
19 # Required-Start: $syslog $remote_fs $network tao-cosnaming
20 # Should-Start: $time ypbind smtp
21 # Required-Stop: $syslog $remote_fs tao-cosnaming
22 # Should-Stop: $time ypbind smtp
23 # Default-Start: 3 5
24 # Default-Stop: 0 1 2 6
25 # Short-Description: Starts and stops the TAO CosEvent Service.
26 # Description: Start tao-cosevent, the TAO CosEvent Service.
27 ### END INIT INFO
29 # Check for missing binaries (stale symlinks should not happen)
30 # Note: Special treatment of stop for LSB conformance
31 TAO_COSEVENT_BIN=/usr/sbin/tao-cosevent
33 test -x $TAO_COSEVENT_BIN || { echo "$TAO_COSEVENT_BIN not installed";
34 if [ "$1" = "stop" ]; then exit 0;
35 else exit 5; fi; }
37 # Check for existence of needed config file and read it
38 TAO_COSEVENT_CONFIG=/etc/tao/tao-cosevent
40 test -r $TAO_COSEVENT_CONFIG || { echo "$TAO_COSEVENT_CONFIG not existing";
41 if [ "$1" = "stop" ]; then exit 0;
42 else exit 6; fi; }
44 # Read config
45 . $TAO_COSEVENT_CONFIG
47 # Source LSB init functions
48 # providing start_daemon, killproc, pidofproc,
49 # log_success_msg, log_failure_msg and log_warning_msg.
50 # This is currently not used by UnitedLinux based distributions and
51 # not needed for init scripts for UnitedLinux only. If it is used,
52 # the functions from rc.status should not be sourced or used.
53 #. /lib/lsb/init-functions
55 # Shell functions sourced from /etc/rc.status:
56 # rc_check check and set local and overall rc status
57 # rc_status check and set local and overall rc status
58 # rc_status -v be verbose in local rc status and clear it afterwards
59 # rc_status -v -r ditto and clear both the local and overall rc status
60 # rc_status -s display "skipped" and exit with status 3
61 # rc_status -u display "unused" and exit with status 3
62 # rc_failed set local and overall rc status to failed
63 # rc_failed <num> set local and overall rc status to <num>
64 # rc_reset clear both the local and overall rc status
65 # rc_exit exit appropriate to overall rc status
66 # rc_active checks whether a service is activated by symlinks
67 . /etc/rc.status
69 # Reset status of this service
70 rc_reset
72 # Return values acc. to LSB for all commands but status:
73 # 0 - success
74 # 1 - generic or unspecified error
75 # 2 - invalid or excess argument(s)
76 # 3 - unimplemented feature (e.g. "reload")
77 # 4 - user had insufficient privileges
78 # 5 - program is not installed
79 # 6 - program is not configured
80 # 7 - program is not running
81 # 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
83 # Note that starting an already running service, stopping
84 # or restarting a not-running service as well as the restart
85 # with force-reload (in case signaling is not supported) are
86 # considered a success.
87 # Source configuration options
88 prog=tao-cosevent
89 OPTIONS="$TAO_COSEVENT_INITREF $TAO_COSEVENT_DEBUGLEVEL $TAO_COSEVENT_LOGFILE"
90 svcconf="/etc/tao/${prog}.conf"
91 svcname="TAO event service"
93 case "$1" in
94 start)
95 echo -n "Starting $svcname: "
96 ## Start daemon with startproc(8). If this fails
97 ## the return value is set appropriately by startproc.
98 /sbin/startproc $TAO_COSEVENT_BIN $OPTIONS -ORBSvcConf $svcconf -ORBDaemon
100 # Remember status and be verbose
101 rc_status -v
103 stop)
104 echo -n "Shutting down $svcname: "
105 ## Stop daemon with killproc(8) and if this fails
106 ## killproc sets the return value according to LSB.
108 /sbin/killproc -TERM $TAO_COSEVENT_BIN
110 # Remember status and be verbose
111 rc_status -v
113 try-restart|condrestart)
114 ## Do a restart only if the service was active before.
115 ## Note: try-restart is now part of LSB (as of 1.9).
116 ## RH has a similar command named condrestart.
117 if test "$1" = "condrestart"; then
118 echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
120 $0 status
121 if test $? = 0; then
122 $0 restart
123 else
124 rc_reset # Not running is not a failure.
126 # Remember status and be quiet
127 rc_status
129 restart)
130 ## Stop the service and regardless of whether it was
131 ## running or not, start it again.
132 $0 stop
133 $0 start
135 # Remember status and be quiet
136 rc_status
138 force-reload)
139 ## Signal the daemon to reload its config. Most daemons
140 ## do this on signal 1 (SIGHUP).
141 ## If it does not support it, restart the service if it
142 ## is running.
144 echo -n "Reloading $svcname "
145 ## if it supports it:
146 /sbin/killproc -HUP $TAO_COSEVENT_BIN
147 #touch /var/run/FOO.pid
148 rc_status -v
150 ## Otherwise:
151 #$0 try-restart
152 #rc_status
154 reload)
155 ## Like force-reload, but if daemon does not support
156 ## signaling, do nothing (!)
158 # If it supports signaling:
159 echo -n "Reloading $svcname "
160 /sbin/killproc -HUP $TAO_COSEVENT_BIN
161 #touch /var/run/FOO.pid
162 rc_status -v
164 ## Otherwise if it does not support reload:
165 #rc_failed 3
166 #rc_status -v
168 status)
169 echo -n "Checking for $svcname "
170 ## Check status with checkproc(8), if process is running
171 ## checkproc will return with exit status 0.
173 # Return value is slightly different for the status command:
174 # 0 - service up and running
175 # 1 - service dead, but /var/run/ pid file exists
176 # 2 - service dead, but /var/lock/ lock file exists
177 # 3 - service not running (unused)
178 # 4 - service status unknown :-(
179 # 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
181 # NOTE: checkproc returns LSB compliant status values.
182 /sbin/checkproc $TAO_COSEVENT_BIN
183 # NOTE: rc_status knows that we called this init script with
184 # "status" option and adapts its messages accordingly.
185 rc_status -v
187 probe)
188 ## Optional: Probe for the necessity of a reload, print out the
189 ## argument to this init script which is required for a reload.
190 ## Note: probe is not (yet) part of LSB (as of 1.9)
192 test $svcconf -nt /var/run/TAO-cosevent.pid && echo reload
195 echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
196 exit 1
198 esac
199 rc_exit