~ubuntu-branches/ubuntu/hardy/steam/hardy

« back to all changes in this revision

Viewing changes to redhat/init.d/steam

  • Committer: Bazaar Package Importer
  • Author(s): Alain Schroeder
  • Date: 2006-11-21 16:03:12 UTC
  • mfrom: (2.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061121160312-nf96y6nihzsyd2uv
Tags: 2.2.31-3
Add patch to prevent inconsistent data after shutdown.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
#
3
 
# steam         This shell script takes care of starting and stopping
4
 
#               the sTeam server.
5
 
#
6
 
# chkconfig: - 64 36
7
 
# description:  sTeam server.
8
 
# processname: steam
9
 
# config: /usr//share/steam/config/steam.cnf
10
 
# pidfile: /var/run/steam.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="steam"
20
 
pidfile="/var/run/steam.pid"
21
 
steamhome="/usr//share/steam"
22
 
 
23
 
 
24
 
start(){
25
 
        ret=0
26
 
        cd $steamhome && ./start --pid="$pidfile" &> $steamhome/logs/init.d_start.log &
27
 
        # Give server 10 seconds to start:
28
 
        for x in 1 2 3 4 5 6 7 8 9 10; do
29
 
        if [ -e "$pidfile" ]; then
30
 
                break;
31
 
        else
32
 
                sleep 1;
33
 
        fi
34
 
        done
35
 
        if [ -e "$pidfile" ]; then
36
 
                action $"Starting $prog: " /bin/true
37
 
                touch /var/lock/subsys/$prog
38
 
                ret=0
39
 
        else
40
 
                action $"Starting $prog: " /bin/false
41
 
                ret=-1
42
 
        fi
43
 
        return $ret
44
 
}
45
 
 
46
 
stop(){
47
 
        cd $steamhome && ./stop --pid="$pidfile" &> $steamhome/logs/init.d_stop.log
48
 
        #kill `cat $pidfile` &> $steamhome/logs/init.d_stop.log
49
 
        ret=$?
50
 
        if [ $ret -eq 0 ]; then
51
 
            action $"Stopping $prog: " /bin/true
52
 
        else
53
 
            action $"Stopping $prog: " /bin/false
54
 
        fi
55
 
        [ $ret -eq 0 ] && rm -f /var/lock/subsys/$prog
56
 
        return $ret
57
 
}
58
 
 
59
 
restart(){
60
 
    stop
61
 
    sleep 2
62
 
    start
63
 
}
64
 
 
65
 
condrestart(){
66
 
    [ -e /var/lock/subsys/$prog ] && restart || :
67
 
}
68
 
 
69
 
# See how we were called.
70
 
case "$1" in
71
 
  start)
72
 
    start
73
 
    ;;
74
 
  stop)
75
 
    stop
76
 
    ;;
77
 
  status)
78
 
    status $prog
79
 
    ;;
80
 
  restart)
81
 
    restart
82
 
    ;;
83
 
  condrestart)
84
 
    condrestart
85
 
    ;;
86
 
  *)
87
 
    echo $"Usage: $0 {start|stop|status|condrestart|restart}"
88
 
    exit 1
89
 
esac
90
 
 
91
 
exit $?
92