1
|
#! /bin/sh
|
2
|
### BEGIN INIT INFO
|
3
|
# Provides: larpe
|
4
|
# Required-Start: $local_fs $network
|
5
|
# Required-Stop: $local_fs $network
|
6
|
# Default-Start: 2 3 4 5
|
7
|
# Default-Stop: 0 1 6
|
8
|
# Short-Description: Start Larpe Liberty Alliance reverse proxy
|
9
|
# Description: Start Larpe Liberty Alliance reverse proxy
|
10
|
### END INIT INFO
|
11
|
|
12
|
set -e
|
13
|
|
14
|
# Gracefully exit if the package has been removed.
|
15
|
test -x $DAEMON || exit 0
|
16
|
|
17
|
# Source function library
|
18
|
. /lib/lsb/init-functions
|
19
|
|
20
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
21
|
DESC="larpe"
|
22
|
NAME=larpe
|
23
|
DAEMON=/usr/sbin/larpectl
|
24
|
PIDFILE=/var/run/$NAME.pid
|
25
|
SCRIPTNAME=/etc/init.d/$NAME
|
26
|
|
27
|
|
28
|
# Read config file if it is present.
|
29
|
if [ -r /etc/default/$NAME ]
|
30
|
then
|
31
|
. /etc/default/$NAME
|
32
|
fi
|
33
|
|
34
|
#
|
35
|
# Function that starts the daemon/service.
|
36
|
#
|
37
|
d_start() {
|
38
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --oknodo \
|
39
|
--chuid www-data:www-data --make-pidfile --background --exec $DAEMON -- start $OPTIONS
|
40
|
}
|
41
|
|
42
|
#
|
43
|
# Function that stops the daemon/service.
|
44
|
#
|
45
|
d_stop() {
|
46
|
start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
|
47
|
rm -f $PIDFILE
|
48
|
}
|
49
|
|
50
|
case "$1" in
|
51
|
start)
|
52
|
log_begin_msg "Starting $DESC: $NAME"
|
53
|
d_start
|
54
|
log_end_msg $?
|
55
|
;;
|
56
|
|
57
|
stop)
|
58
|
log_begin_msg "Stopping $DESC: $NAME"
|
59
|
d_stop
|
60
|
log_end_msg $?
|
61
|
;;
|
62
|
|
63
|
restart|force-reload)
|
64
|
#
|
65
|
# If the "reload" option is implemented, move the "force-reload"
|
66
|
# option to the "reload" entry above. If not, "force-reload" is
|
67
|
# just the same as "restart".
|
68
|
#
|
69
|
log_begin_msg "Restarting $DESC: $NAME"
|
70
|
d_stop
|
71
|
sleep 1
|
72
|
d_start
|
73
|
log_end_msg $?
|
74
|
;;
|
75
|
|
76
|
*)
|
77
|
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
|
78
|
exit 1
|
79
|
;;
|
80
|
esac
|
81
|
|
82
|
exit 0
|