author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Sat, 13 Dec 2008 15:42:15 +0100 | |
changeset 26 | 767f79e69de1 |
parent 0 | 586472add385 |
child 27 | 4a2f7a1492ab |
permissions | -rwxr-xr-x |
0 | 1 |
#!/bin/sh |
2 |
||
26
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
3 |
### BEGIN INIT INFO |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
4 |
# Provides: mcbot |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
5 |
# Required-Start: $remote_fs $syslog |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
6 |
# Required-Stop: $remote_fs $syslog |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
7 |
# Default-Start: 2 3 4 5 |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
8 |
# Default-Stop: 0 1 6 |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
9 |
# Short-Description: IRC BOT mcbot |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
10 |
# Description: IRC BOT mcbot |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
11 |
### END INIT INFO |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
12 |
|
0 | 13 |
BINARY="mcbot" |
26
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
14 |
DIRECTORY="/usr/sbin/" |
0 | 15 |
LANGUAGE="de_DE.UTF-8" |
16 |
||
17 |
[[ ! -x "${DIRECTORY}/${BINARY}" ]] && exit 0 |
|
18 |
||
19 |
start() { |
|
20 |
echo -n "Starting ${BINARY}" |
|
21 |
su - nobody -c "LANG=$LANGUAGE ${DIRECTORY}/${BINARY} &>/var/lib/nobody/mcbot-`date "+%d-%m-%y"`.log &" |
|
22 |
if [ "$?" == 0 ]; then |
|
23 |
echo " [started]" |
|
24 |
fi |
|
25 |
} |
|
26 |
||
27 |
stop() { |
|
28 |
echo -n "Stopping ${BINARY}" |
|
29 |
pid=`pidof ${BINARY}` |
|
30 |
if [ "$pid" != "" ]; then |
|
31 |
kill -TERM `pidof ${BINARY}` |
|
32 |
sleep 5 |
|
33 |
fi |
|
34 |
echo " [stopped]" |
|
35 |
} |
|
36 |
||
37 |
status() { |
|
38 |
pid="`pidof ${BINARY}`" |
|
39 |
if [ "$pid" != "" ]; then |
|
40 |
echo "${BINARY} is started as ${pid}" |
|
41 |
else |
|
42 |
echo "${BINARY} is not running" |
|
43 |
fi |
|
44 |
} |
|
45 |
||
46 |
case "$1" in |
|
47 |
start) |
|
48 |
start |
|
49 |
;; |
|
50 |
stop) |
|
51 |
stop |
|
52 |
;; |
|
53 |
status) |
|
54 |
status |
|
55 |
;; |
|
56 |
restart) |
|
57 |
echo "Restarting ${BINARY}" |
|
58 |
stop |
|
59 |
start |
|
60 |
;; |
|
26
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
61 |
force-reload) |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
62 |
echo "Force reload stub" |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
63 |
stop |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
64 |
start |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
65 |
;; |
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
66 |
|
0 | 67 |
*) |
26
767f79e69de1
Debian QoS - Lintian Checks
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
0
diff
changeset
|
68 |
echo "Usage: start|stop|restart|status|force-reload" |
0 | 69 |
;; |
70 |
esac |
|
71 |
||
72 |
exit 0 |