5
# and its symbolic link
11
# Required-Start: $network $remote_fs $mysqld
13
# Default-Start: 2 3 5
15
# Description: Start the open-sTeam server
18
# Shell functions sourced from /etc/rc.status:
19
# rc_check check and set local and overall rc status
20
# rc_status check and set local and overall rc status
21
# rc_status -v ditto but be verbose in local rc status
22
# rc_status -v -r ditto and clear the local rc status
23
# rc_failed set local and overall rc status to failed
24
# rc_failed <num> set local and overall rc status to <num>
25
# rc_reset clear local rc status (overall remains)
26
# rc_exit exit appropriate to overall rc status
29
# First reset status of this service
32
# Return values acc. to LSB for all commands but status:
34
# 1 - generic or unspecified error
35
# 2 - invalid or excess argument(s)
36
# 3 - unimplemented feature (e.g. "reload")
37
# 4 - insufficient privilege
38
# 5 - program is not installed
39
# 6 - program is not configured
40
# 7 - program is not running
42
# Note that starting an already running service, stopping
43
# or restarting a not-running service as well as the restart
44
# with force-reload (in case signalling is not supported) are
45
# considered a success.
48
pidfile="/var/run/@brand@.pid"
49
steamhome="@steamdir@"
50
configdir="@configdir@"
52
JAVA_HOME="@javahome@"
55
mode=$1 # start or stop
57
# Safeguard (relative paths, core dumps..)
62
# exit gracefully, if we are already running
63
checkproc $prog && echo -n "Starting service @brand@" && \
64
rc_status -v && rc_exit
66
echo -n "Starting service @brand@"
68
cd $steamhome && ./start --restart --pid="$pidfile" &> $logdir/init.d_start.log &
70
for((i=0; i<50; i++)); do
72
test -e $pidfile && i='' && break
75
test -z "$i" || rc_failed
77
# Rmember status and be verbose
82
echo -n "Shutting down service @brand@"
83
cd $steamhome && ./stop --pid="$pidfile" &> $logdir/init.d_stop.log
84
#killproc -p $pidfile -TERM $prog
86
# Remember status and be verbose
91
## Stop the service and if this succeeds (i.e. the
92
## service was running before), start it again.
93
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
94
$0 status >/dev/null && $0 restart
96
# Remember status and be quiet
100
restart|force-reload|reload)
101
echo "Restarting service @brand@"
109
echo -n "Checking for service @brand@: "
110
## Check status with checkproc(8), if process is running
111
## checkproc will return with exit status 0.
113
# Status has a slightly different for the status command:
114
# 0 - service running
115
# 1 - service dead, but /var/run/ pid file exists
116
# 2 - service dead, but /var/lock/ lock file exists
117
# 3 - service not running
119
# NOTE: checkproc returns LSB compliant status values.
125
echo "Usage: $0 {start|stop|status|reload|restart|try-restart|force-reload}"