forked from Clommunity/cDistro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdistro
55 lines (50 loc) · 999 Bytes
/
cdistro
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: cDistro
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/Stop web configuration server
### END INIT INFO
NAME=cdistro
CONFFILE="/etc/cloudy/cloudy.conf"
PIDFILE="/var/run/cdistro.pid"
PIDDAEMON="/var/run/cdistrod.pid"
DAEMON="/usr/sbin/cdistrod"
test -f $CONFFILE && . $CONFFILE || exit 0
start() {
$SERVER $OPTS -S $BINDIP:$PORT -t $DOCROOT >/dev/null 2>&1 &
echo $! > $PIDFILE
$DAEMON >/dev/null 2>&1 &
echo $! > $PIDDAEMON
}
stop() {
kill -9 $(cat $PIDFILE)
rm $PIDFILE
kill -9 $(cat $PIDDAEMON)
rm $PIDDAEMON
}
restart() {
stop
sleep 0.5
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
exit 1
;;
esac
exit 0