~ubuntu-branches/ubuntu/wily/steam/wily

« back to all changes in this revision

Viewing changes to distrib/generic/init.d/steam.in

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-10-29 19:51:18 UTC
  • mfrom: (1.1.4) (0.1.4 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131029195118-b9bxciz5hwx5z459
Tags: 1:1.0.0.39-2ubuntu1
Add an epoch to the version number as there was an unrelated steam package
in the archive with a higher version number.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh
2
 
#
3
 
# init.d file to start the sTeam server.
4
 
 
5
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
6
 
 
7
 
prog="@brand@"
8
 
pidfile="/var/run/@brand@.pid"
9
 
steamhome="@steamdir@"
10
 
configdir="@configdir@"
11
 
logdir="@logdir@"
12
 
JAVA_HOME="@javahome@"
13
 
export JAVA_HOME
14
 
 
15
 
if [ ! -x $steamhome/start ]; then
16
 
    echo -n "sTeam startup script not executeable !"
17
 
    exit 0
18
 
fi
19
 
 
20
 
set -e
21
 
 
22
 
start(){
23
 
    echo -n "Starting sTeam server... "
24
 
    cd $steamhome && ./start --restart --pid="$pidfile" &> $logdir/init.d_start.log &
25
 
    for x in 1 2 3 4 5 6 7 8 9 10; do
26
 
        if [ -e "$pidfile" ]; then
27
 
            break
28
 
        else
29
 
            sleep 1
30
 
        fi
31
 
    done
32
 
    if [ -e "$pidfile" ]; then
33
 
        echo "sTeam server started"
34
 
        if [ -e /var/lock/subsys ]; then
35
 
            touch /var/lock/subsys/$prog
36
 
        fi
37
 
        return 0
38
 
    else
39
 
        echo "Failed to start sTeam server!"
40
 
        return -1
41
 
    fi
42
 
}
43
 
 
44
 
 
45
 
stop(){
46
 
    echo -n "Stopping sTeam server... "
47
 
    cd $steamhome && ./stop --pid="$pidfile" &> $logdir/init.d_stop.log
48
 
    #kill `cat $pidfile` &> $logdir/init.d_stop.log
49
 
    ret=$?
50
 
    if [ $ret -eq 0 ]; then
51
 
        echo "sTeam server stopped"
52
 
    else
53
 
        echo "Failed to stop sTeam server! (Is the server really running?)"
54
 
    fi
55
 
    if [ -f $pidfile ]; then
56
 
        rm -f $pidfile
57
 
    fi
58
 
    if [ -e /var/lock/subsys/$prog ]; then
59
 
        rm -f /var/lock/subsys/$prog
60
 
    fi
61
 
    return $ret
62
 
}
63
 
 
64
 
 
65
 
case "$1" in
66
 
  start)
67
 
    if [ -f $pidfile ]; then
68
 
        echo "PID file exists, restarting sTeam server."
69
 
        stop
70
 
        sleep 2
71
 
    fi
72
 
    start
73
 
    ;;
74
 
  stop)
75
 
    if [ ! -f $pidfile ]; then
76
 
        echo "sTeam server is not running"
77
 
        exit 0
78
 
    fi
79
 
    stop
80
 
    ;;
81
 
  restart|force-reload|condrestart)
82
 
    if [ -f $pidfile ]; then
83
 
        stop
84
 
        sleep 2
85
 
    fi
86
 
    start
87
 
    ;;
88
 
  *)
89
 
    echo $"Usage: $0 {start|stop|status|condrestart|restart}"
90
 
    exit 1
91
 
    ;;
92
 
esac
93
 
 
94
 
exit $?