~ubuntu-branches/ubuntu/saucy/steam/saucy-backports

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-10-29 19:51:18 UTC
  • mfrom: (0.2.4) (3.2.1 trusty-proposed)
  • mto: This revision was merged to the branch mainline in revision 4.
  • 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/bash
2
 
#
3
 
# @brand@       This shell script takes care of starting and stopping
4
 
#               the open-sTeam server.
5
 
#
6
 
# chkconfig: - 64 36
7
 
# description:  open-sTeam server.
8
 
# processname: steam
9
 
# config: @configdir@/steam.cnf
10
 
# pidfile: /var/run/@brand@.pid
11
 
 
12
 
# Source function library.
13
 
. /etc/rc.d/init.d/functions
14
 
 
15
 
# Source networking configuration.
16
 
. /etc/sysconfig/network
17
 
 
18
 
 
19
 
prog="@brand@"
20
 
pidfile="/var/run/@brand@.pid"
21
 
steamhome="@steamdir@"
22
 
configdir="@configdir@"
23
 
logdir="@logdir@"
24
 
JAVA_HOME="@javahome@"
25
 
export JAVA_HOME
26
 
 
27
 
start(){
28
 
        ret=0
29
 
        cd $steamhome && ./start --restart --pid="$pidfile" &> $logdir/init.d_start.log &
30
 
        # Give server 10 seconds to start:
31
 
        for x in 1 2 3 4 5 6 7 8 9 10; do
32
 
        if [ -e "$pidfile" ]; then
33
 
                break;
34
 
        else
35
 
                sleep 1;
36
 
        fi
37
 
        done
38
 
        if [ -e "$pidfile" ]; then
39
 
                action $"Starting $prog: " /bin/true
40
 
                touch /var/lock/subsys/$prog
41
 
                ret=0
42
 
        else
43
 
                action $"Starting $prog: " /bin/false
44
 
                ret=-1
45
 
        fi
46
 
        return $ret
47
 
}
48
 
 
49
 
stop(){
50
 
        cd $steamhome && ./stop --pid="$pidfile" &> $logdir/init.d_stop.log
51
 
        #kill `cat $pidfile` &> $logdir/init.d_stop.log
52
 
        ret=$?
53
 
        if [ $ret -eq 0 ]; then
54
 
            action $"Stopping $prog: " /bin/true
55
 
        else
56
 
            action $"Stopping $prog: " /bin/false
57
 
        fi
58
 
        [ $ret -eq 0 ] && rm -f /var/lock/subsys/$prog
59
 
        return $ret
60
 
}
61
 
 
62
 
restart(){
63
 
    stop
64
 
    sleep 2
65
 
    start
66
 
}
67
 
 
68
 
condrestart(){
69
 
    [ -e /var/lock/subsys/$prog ] && restart || :
70
 
}
71
 
 
72
 
# See how we were called.
73
 
case "$1" in
74
 
  start)
75
 
    start
76
 
    ;;
77
 
  stop)
78
 
    stop
79
 
    ;;
80
 
  status)
81
 
    status $prog
82
 
    ;;
83
 
  restart)
84
 
    restart
85
 
    ;;
86
 
  condrestart)
87
 
    condrestart
88
 
    ;;
89
 
  *)
90
 
    echo $"Usage: $0 {start|stop|status|condrestart|restart}"
91
 
    exit 1
92
 
esac
93
 
 
94
 
exit $?