-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.debian
executable file
·63 lines (53 loc) · 1.41 KB
/
init.debian
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
56
57
58
59
60
61
62
#!/bin/sh
### BEGIN INIT INFO
# Provides: housesprinkler
# Required-Start: $network $remote_fs $syslog $houseportal
# Required-Stop: $network $remote_fs $syslog $houseportal
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Irrigation scheduling and control
# Description: A web service that schedules watering by controling sprinklers
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/usr/local/bin/housesprinkler
PIDFILE=/var/run/housesprinkler.pid
test -x $DAEMON || exit 0
HTTP_OPTS=
OTHER_OPTS=
if [ -r /etc/default/housesprinkler ]; then
. /etc/default/housesprinkler
fi
case $1 in
start)
log_daemon_msg "Starting HouseSprinkler server" "housesprinkler"
start-stop-daemon --start --quiet --oknodo --background --pidfile $PIDFILE --make-pidfile --startas $DAEMON -- $HTTP_OPTS $OTHER_OPTS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping HouseSprinkler server" "housesprinkler"
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --retry=TERM/30/KILL/5 --exec $DAEMON
log_end_msg $?
rm -f $PIDFILE
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
exit 3
;;
status)
status_of_proc $DAEMON "HouseSprinkler server"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 2
;;
esac