3
# Template LSB system startup script for example service/daemon FOO
4
# Copyright (C) 1995--2005 Kurt Garloff, SUSE / Novell Inc.
5
# Copyright (C) 2010 Silicon Software GmbH
7
# This library is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU Lesser General Public License as published by
9
# the Free Software Foundation; either version 2.1 of the License, or (at
10
# your option) any later version.
12
# This library is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# Lesser General Public License for more details.
17
# You should have received a copy of the GNU Lesser General Public
18
# License along with this library; if not, write to the Free Software
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
22
# /etc/init.d/siso-gbe
24
# chkconfig: 345 99 00
25
# description: camera control proxy daemon
29
# Required-Start: $syslog $remote_fs $time $network
30
# Required-Stop: $syslog $remote_fs
31
# Default-Start: 3 4 5
32
# Default-Stop: 0 1 2 6
33
# Short-Description: camera control proxy daemon
34
# Description: camera control proxy daemon
38
# Default: Assume sysvinit binaries exist
39
start_daemon() { /sbin/start_daemon ${1+"$@"}; }
40
killproc() { /sbin/killproc ${1+"$@"}; }
41
pidofproc() { /sbin/pidofproc ${1+"$@"}; }
42
checkproc() { /sbin/checkproc ${1+"$@"}; }
44
if test -e /etc/rc.status; then
45
# SUSE rc script library
51
if test "${_cmd}" = "status"; then
52
_SMSG=(running dead dead unused unknown reserved)
55
_SMSG=(done failed failed missed failed skipped unused failed failed reserved)
58
if test -e /lib/lsb/init-functions; then
60
. /lib/lsb/init-functions
63
if test ${_RC_RV} = 0; then
64
log_success_msg " [${_SMSG[${_RC_RV}]}] "
66
log_failure_msg " [${_SMSG[${_RC_RV}]}] "
69
# TODO: Add checking for lockfiles
70
checkproc() { return pidofproc ${1+"$@"} >/dev/null 2>&1; }
71
elif test -e /etc/init.d/functions; then
73
. /etc/init.d/functions
76
#echo -n " [${_SMSG[${_RC_RV}]}] "
77
if test ${_RC_RV} = 0; then
78
success " [${_SMSG[${_RC_RV}]}] "
80
failure " [${_SMSG[${_RC_RV}]}] "
83
checkproc() { return status ${1+"$@"}; }
84
start_daemon() { return daemon ${1+"$@"}; }
87
echo_rc() { echo " [${_SMSG[${_RC_RV}]}] "; }
89
rc_reset() { _RC_RV=0; }
94
elif test "$1" != "0"; then
106
if test "$1" = "-r"; then _RC_RV=0; shift; fi
107
if test "$1" = "-s"; then rc_failed 5; echo_rc; rc_failed 3; shift; fi
108
if test "$1" = "-u"; then rc_failed ${_RC_UNUSED}; echo_rc; rc_failed 3; shift; fi
109
if test "$1" = "-v"; then echo_rc; shift; fi
110
if test "$1" = "-r"; then _RC_RV=0; shift; fi
113
rc_exit() { exit ${_RC_RV}; }
116
if test -z "$RUNLEVEL"; then read RUNLEVEL REST < <(/sbin/runlevel); fi
117
if test -e /etc/init.d/S[0-9][0-9]${1}; then return 0; fi
122
# Reset status of this service
125
# Return values acc. to LSB for all commands but status:
127
# 1 - generic or unspecified error
128
# 2 - invalid or excess argument(s)
129
# 3 - unimplemented feature (e.g. "reload")
130
# 4 - user had insufficient privileges
131
# 5 - program is not installed
132
# 6 - program is not configured
133
# 7 - program is not running
134
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
136
# Note that starting an already running service, stopping
137
# or restarting a not-running service as well as the restart
138
# with force-reload (in case signaling is not supported) are
139
# considered a success.
143
echo -n "Starting pfserver "
144
## Start daemon with startproc(8). If this fails
145
## the return value is set appropriately by startproc.
146
start_daemon -p /var/run/pfcomserver.pid -l /var/log/pfcomserver.log /opt/camera/bin/pfserver
148
# Remember status and be verbose
152
echo -n "Shutting down pfserver "
153
## Stop daemon with killproc(8) and if this fails
154
## killproc sets the return value according to LSB.
155
killproc -TERM /opt/camera/bin/pfserver -p /var/run/pfcomserver.pid
157
# Remember status and be verbose
160
try-restart|condrestart)
161
## Do a restart only if the service was active before.
162
## Note: try-restart is now part of LSB (as of 1.9).
163
## RH has a similar command named condrestart.
164
if test "$1" = "condrestart"; then
165
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
171
rc_reset # Not running is not a failure.
173
# Remember status and be quiet
177
## Stop the service and regardless of whether it was
178
## running or not, start it again.
182
# Remember status and be quiet
194
echo -n "Checking for pfserver "
195
## Check status with checkproc(8), if process is running
196
## checkproc will return with exit status 0.
198
# Return value is slightly different for the status command:
199
# 0 - service up and running
200
# 1 - service dead, but /var/run/ pid file exists
201
# 2 - service dead, but /var/lock/ lock file exists
202
# 3 - service not running (unused)
203
# 4 - service status unknown :-(
204
# 5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)
206
# NOTE: checkproc returns LSB compliant status values.
207
checkproc /opt/camera/bin/pfserver
208
# NOTE: rc_status knows that we called this init script with
209
# "status" option and adapts its messages accordingly.
213
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"