4
# Required-Start: $local_fs $remote_fs
5
# Required-Stop: $local_fs $remote_fs
6
# Default-Start: 2 3 4 5
7
# Default-Stop: S 0 1 6
8
# Short-Description: sTeam server init script
9
# Description: This script controls the open-sTeam server
12
# Author: Robert Hinn <exodus@uni-paderborn.de>
14
# PATH should only include /usr/* if it runs after the mountnfs.sh script
15
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
18
DAEMON_DIR=/usr/share/steam
20
DAEMON_ARGS="--restart"
22
PIDFILE=/var/run/$NAME.pid
23
SCRIPTNAME=/etc/init.d/$NAME
26
# Exit if the package is not installed
27
[ -x "/$DAEMON_DIR/$DAEMON" ] || exit 0
29
# Read configuration variable file if it is present
30
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
32
# Load the VERBOSE setting and other rcS variables
33
[ -f /etc/default/rcS ] && . /etc/default/rcS
35
# Define LSB log_* functions.
36
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
37
#. /lib/lsb/init-functions
38
# (this is not available in Debian Sarge, yet, so we define these functions:)
40
if [ -z "${1:-}" ]; then
44
if [ -z "${2:-}" ]; then
53
# If no arguments were passed, return
54
[ -z "${1:-}" ] && return 1
64
# try to detect a java runtime:
65
if [ -z $JAVA_HOME ] && [ -e /etc/alternatives/java ]; then
66
# the BACKTICK is just a workaround to allow 'cut' to look for '`':
68
JAVA_HOME="`LANG=C file -b /etc/alternatives/java | cut -f 2 -d "$BACKTICK" | cut -f 1 -d \' | sed -e 's/\/bin\/java$//'`"
69
# Only export if this is actually a directory:
70
if [ -d "$JAVA_HOME" ]; then
77
# Function that starts the daemon/service
81
[ -f $PIDFILE ] && return 1
82
cd "$DAEMON_DIR" && "./$DAEMON" "$DAEMON_ARGS" --pid="$PIDFILE" > /dev/null 2>&1 &
83
for x in 1 2 3 4 5 6 7 8 9 10; do
84
[ -f $PIDFILE ] && return 0
91
# Function that stops the daemon/service
95
[ -f "$PIDFILE" ] || return 1
96
cd "$DAEMON_DIR" && ./$DAEMON_STOP --pid="$PIDFILE" > /dev/null 2>&1 &
97
for x in 1 2 3 4 5 6 7 8 9 10; do
98
[ -f "$PIDFILE" ] || return 0
105
# Function that sends a SIGHUP to the daemon/service
109
# If the daemon can reload its configuration without
110
# restarting (for example, when it is sent a SIGHUP),
111
# then implement that here.
113
#start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
119
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
122
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
123
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
127
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
130
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
131
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
134
#reload|force-reload)
136
# If do_reload() is not implemented then leave this commented out
137
# and leave 'force-reload' as an alias for 'restart'.
139
#log_daemon_msg "Reloading $DESC" "$NAME"
143
restart|force-reload)
145
# If the "reload" option is implemented then remove the
146
# 'force-reload' alias
148
log_daemon_msg "Restarting $DESC" "$NAME"
155
1) log_end_msg 1 ;; # Old process is still running
156
*) log_end_msg 1 ;; # Failed to start
166
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
167
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2