forked from dozencrows/motion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
motion.init-Debian.in
69 lines (56 loc) · 1.36 KB
/
motion.init-Debian.in
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
63
64
65
66
67
68
69
#! /bin/bash
#
# @PACKAGE_NAME@ @PACKAGE_VERSION@
# Start the motion detection .
#
NAME=@PACKAGE_NAME@
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=@BIN_PATH@/@PACKAGE_NAME@
PIDFILE=/var/run/@PACKAGE_NAME@/$NAME.pid
trap "" 1
export LANG=C
export PATH
test -f $DAEMON || exit 0
case "$1" in
start)
echo "Starting @PACKAGE_NAME@ detection : $NAME"
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --chuid motion
;;
stop)
echo "Stopping @PACKAGE_NAME@ detection : $NAME"
start-stop-daemon --stop --pidfile $PIDFILE --oknodo --exec $DAEMON --retry 30
;;
status)
echo "Status @PACKAGE_NAME@ detection : $NAME"
if (test -f $PIDFILE); then
echo -n "Running process for $NAME : "
pidof $NAME
else
echo "Stopped"
fi
;;
reload-config)
echo "Reloading $NAME configuration"
start-stop-daemon --stop --pidfile $PIDFILE --signal HUP --exec $DAEMON
;;
restart-motion)
echo "Restarting $NAME"
start-stop-daemon --stop --pidfile $PIDFILE --oknodo --exec $DAEMON --retry 30
start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON --chuid motion
;;
restart)
$0 restart-motion
exit $?
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|status|reload-config|restart}"
exit 1
;;
esac
if [ $? == 0 ]; then
echo .
exit 0
else
echo failed
exit 1
fi