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

motion: adapted configuration parameters to version 4.4.0
author Hans-G?nter Theisgen
date Sun Aug 21 17:07:48 2022 +0100 (2022-08-21)
parents 7c04901ef470
children
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.
4 #
5 . /etc/init.d/rc.functions
7 NAME=Motion
8 DESC="$(_ 'Video detection daemon')"
9 DAEMON=/usr/bin/motion
10 PIDFILE=/run/motion/motion.pid
12 case "$1" in
13 (start)
14 if active_pidfile $PIDFILE motion
15 then
16 _ '%s is already running.' $NAME
17 exit 1
18 fi
19 action 'Starting %s: %s...' "$DESC" $NAME
20 mkdir -p $(dirname $PIDFILE)
21 $DAEMON -p $PIDFILE
22 status
23 ;;
24 (stop)
25 if ! active_pidfile $PIDFILE motion
26 then
27 _ '%s is not running.' $NAME
28 exit 1
29 fi
30 action 'Stopping %s: %s...' "$DESC" $NAME
31 kill $(cat $PIDFILE)
32 status
33 ;;
34 (restart)
35 if ! active_pidfile $PIDFILE motion
36 then
37 echo "$NAME is not running."
38 exit 1
39 fi
40 _ 'Restarting %s: %s...' "$DESC" $NAME
41 kill $(cat $PIDFILE)
42 sleep 2
43 $DAEMON -p $PIDFILE
44 status
45 ;;
46 (*)
47 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
48 newline
49 exit 1
50 ;;
51 esac
53 exit 0