-
Notifications
You must be signed in to change notification settings - Fork 3
/
blitterd.sh
executable file
·38 lines (33 loc) · 991 Bytes
/
blitterd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
### BEGIN INIT INFO
# Provides: blitterbike
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop BlitterBike server
### END INIT INFO
logger "blitterd: Start script executed"
pushd `dirname $0` > /dev/null
BLITTERBIKEPATH=`pwd -P`
popd > /dev/null
export PYTHONPATH="$BLITTERBIKEPATH:$PYTHONPATH"
export BLITTERBIKEPATH="$BLITTERBIKEPATH"
case "$1" in
start)
logger "blitterd: Starting"
echo "Starting blitterd..."
/usr/local/bin/twistd -y "$BLITTERBIKEPATH/blitterd.tac" -l "$BLITTERBIKEPATH/blitterd.log" --pidfile "$BLITTERBIKEPATH/blitterd.pid"
;;
stop)
logger "blitterd: Stopping"
echo "Stopping blitterd..."
kill `cat "$BLITTERBIKEPATH/blitterd.pid"`
;;
*)
logger "blitterd: Invalid usage"
echo "Usage: blitterbike {start|stop}"
exit 1
;;
esac
exit 0