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

marco, mate-desktop: update deps
author Yuri Pourre <yuripourre@gmail.com>
date Thu Jun 11 13:50:11 2015 -0300 (2015-06-11)
parents
children 7f188676b59c
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"
10 DAEMON=/usr/bin/motion
11 PIDFILE=/run/motion/motion.pid
13 case "$1" in
14 start)
15 if active_pidfile $PIDFILE motion ; then
16 echo "$NAME already running."
17 exit 1
18 fi
19 echo "Starting $DESC: $NAME... "
20 mkdir -p $(dirname $PIDFILE)
21 $DAEMON -p $PIDFILE ;;
22 stop)
23 if ! active_pidfile $PIDFILE motion ; then
24 echo "$NAME is not running."
25 exit 1
26 fi
27 echo -n "Stopping $DESC: $NAME... "
28 kill $(cat $PIDFILE)
29 rm $PIDFILE
30 status ;;
31 restart)
32 if ! active_pidfile $PIDFILE motion ; then
33 echo "$NAME is not running."
34 exit 1
35 fi
36 echo "Restarting $DESC: $NAME... "
37 kill $(cat $PIDFILE)
38 rm $PIDFILE
39 sleep 2
40 $DAEMON -p $PIDFILE ;;
41 *)
42 echo ""
43 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
44 echo ""
45 exit 1 ;;
46 esac
48 exit 0