~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/pvpgn

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>
 
4
#               Modified for Debian by Ian Murdock <imurdock@gnu.ai.mit.edu>
 
5
#
 
6
 
 
7
### BEGIN INIT INFO
 
8
# Provides:          pvpgn
 
9
# Required-Start:    $local_fs $remote_fs $syslog $network $time
 
10
# Required-Stop:     $local_fs $remote_fs $syslog $network
 
11
# Default-Start:     2 3 4 5
 
12
# Default-Stop:      0 1 6
 
13
# Short-Description: Gaming server that emulates Battle.net(R)
 
14
# Description: control bnetd daemon
 
15
### END INIT INFO
 
16
 
 
17
set -e
 
18
 
 
19
. /lib/lsb/init-functions
 
20
 
 
21
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
22
DAEMON=/usr/sbin/bnetd
 
23
NAME=bnetd
 
24
DESC="bnetd daemon"
 
25
 
 
26
# checks for the pvpgn support files
 
27
check_support() 
 
28
{
 
29
# list of files in pvpgn-support-1.2.tar.gz
 
30
FILES="
 
31
 IX86ver1.mpq
 
32
 PMACver1.mpq
 
33
 XMACver1.mpq
 
34
 bnserver-D2DV.ini
 
35
 bnserver-D2XP.ini
 
36
 bnserver-WAR3.ini
 
37
 bnserver.ini
 
38
 icons-WAR3.bni
 
39
 icons.bni
 
40
 icons_STAR.bni
 
41
 ver-ix86-1.mpq
 
42
"
 
43
 
 
44
        START=1
 
45
        for i in $FILES; do
 
46
                if [ ! -f "/var/lib/pvpgn/files/$i" ]; then
 
47
                        START=0;
 
48
                fi
 
49
        done
 
50
 
 
51
        if [ "$START" = "0" ]; then
 
52
                echo
 
53
                echo "You are missing the pvpgn support files and daemon will not start without them."
 
54
                echo "Run 'sudo pvpgn-support-installer' or read /usr/share/doc/pvpgn/README.Debian"
 
55
                exit 0
 
56
        fi
 
57
 
 
58
}
 
59
 
 
60
test -x $DAEMON || exit 0
 
61
 
 
62
case "$1" in
 
63
  start)
 
64
        check_support
 
65
        echo -n "Starting $DESC: "
 
66
        start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
 
67
        echo "$NAME."
 
68
        ;;
 
69
  stop)
 
70
        echo -n "Stopping $DESC: "
 
71
        start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
 
72
        echo "$NAME."
 
73
        ;;
 
74
  status)
 
75
        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
 
76
        ;;
 
77
  restart|force-reload)
 
78
        check_support
 
79
        echo -n "Restarting $DESC: "
 
80
        start-stop-daemon --stop --quiet --exec $DAEMON
 
81
        sleep 1
 
82
        start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS
 
83
        echo "$NAME."
 
84
        ;;
 
85
  *)
 
86
        N=/etc/init.d/$NAME
 
87
        echo "Usage: $N {start|stop|restart|status|force-reload}" >&2
 
88
        exit 1
 
89
        ;;
 
90
esac
 
91
 
 
92
exit 0