wok view motion/stuff/init.d/motion @ rev 24919

updated motion (4.3.0 -> 4.4.0)
author Hans-G?nter Theisgen
date Sun Apr 10 07:17:22 2022 +0100 (2022-04-10)
parents 7f188676b59c
children 67fca9298007
line source
1 #!/bin/sh
2 # /etc/init.d/motion: Start, stop and restart Motion daemon on SliTaz,
3 # at boot time or with the command line. Daemons options are configured
4 # with /etc/daemons.conf
5 #
6 . /etc/init.d/rc.functions
8 NAME=Motion
9 DESC="$(_ 'Video detection daemon')"
10 DAEMON=/usr/bin/motion
11 PIDFILE=/run/motion/motion.pid
13 case "$1" in
14 (start)
15 if active_pidfile $PIDFILE motion
16 then
17 _ '%s is already running.' $NAME
18 exit 1
19 fi
20 action 'Starting %s: %s...' "$DESC" $NAME
21 mkdir -p $(dirname $PIDFILE)
22 $DAEMON -p $PIDFILE
23 status
24 ;;
25 (stop)
26 if ! active_pidfile $PIDFILE motion
27 then
28 _ '%s is not running.' $NAME
29 exit 1
30 fi
31 action 'Stopping %s: %s...' "$DESC" $NAME
32 kill $(cat $PIDFILE)
33 rm $PIDFILE
34 status
35 ;;
36 (restart)
37 if ! active_pidfile $PIDFILE motion
38 then
39 echo "$NAME is not running."
40 exit 1
41 fi
42 _ 'Restarting %s: %s...' "$DESC" $NAME
43 kill $(cat $PIDFILE)
44 rm $PIDFILE
45 sleep 2
46 $DAEMON -p $PIDFILE
47 status
48 ;;
49 (*)
50 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
51 newline
52 exit 1
53 ;;
54 esac
56 exit 0