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