wok diff motion/stuff/init.d/motion @ rev 13652

Fix: motion build and improve package integration
author Christophe Lincoln <pankso@slitaz.org>
date Mon Nov 19 14:21:21 2012 +0100 (2012-11-19)
parents
children 7f188676b59c
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/motion/stuff/init.d/motion	Mon Nov 19 14:21:21 2012 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/motion: Start, stop and restart Motion daemon on SliTaz,
     1.6 +# at boot time or with the command line. Daemons options are configured
     1.7 +# with /etc/daemons.conf
     1.8 +#
     1.9 +. /etc/init.d/rc.functions
    1.10 +
    1.11 +NAME=Motion
    1.12 +DESC="Video detection"
    1.13 +DAEMON=/usr/bin/motion
    1.14 +PIDFILE=/run/motion/motion.pid
    1.15 +
    1.16 +case "$1" in
    1.17 +	start)
    1.18 +		if active_pidfile $PIDFILE motion ; then
    1.19 +			echo "$NAME already running."
    1.20 +			exit 1
    1.21 +		fi
    1.22 +		echo "Starting $DESC: $NAME... "
    1.23 +		mkdir -p $(dirname $PIDFILE)
    1.24 +		$DAEMON -p $PIDFILE ;;
    1.25 +	stop)
    1.26 +		if ! active_pidfile $PIDFILE motion ; then
    1.27 +			echo "$NAME is not running."
    1.28 +			exit 1
    1.29 +		fi
    1.30 +		echo -n "Stopping $DESC: $NAME... "
    1.31 +		kill $(cat $PIDFILE)
    1.32 +		rm $PIDFILE
    1.33 +		status ;;
    1.34 +	restart)
    1.35 +		if ! active_pidfile $PIDFILE motion ; then
    1.36 +			echo "$NAME is not running."
    1.37 +			exit 1
    1.38 +		fi
    1.39 +		echo "Restarting $DESC: $NAME... "
    1.40 +		kill $(cat $PIDFILE)
    1.41 +		rm $PIDFILE
    1.42 +		sleep 2
    1.43 +		$DAEMON -p $PIDFILE ;;
    1.44 +	*)
    1.45 +		echo ""
    1.46 +		echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    1.47 +		echo ""
    1.48 +		exit 1 ;;
    1.49 +esac
    1.50 +
    1.51 +exit 0