#!/bin/sh # # Startup script for the Motion Detection System # # chkconfig: - 85 15 # description: Motion Detection System. It is used to detect \ # movement based on compare images. # # processname: motion # config: /etc/motion/motion.conf # pidfile: /var/run/motion/motion.pid # ### BEGIN INIT INFO # Provides: motion # Short-Description: start and stop motion # Description: This is a daemon for automatically switching network \ # connections to the best available connection. ### END INIT INFO prefix=/usr exec_prefix=/usr bindir=${exec_prefix}/bin MOTION_BIN=${bindir}/motion # Sanity checks. [ -x ${MOTION_BIN} ] || exit 1 # Check that the config file exists [ -f /etc/motion/motion.conf ] || exit 0 # Source function library. . /etc/rc.d/init.d/functions # so we can rearrange this easily processname=motion servicename=motion pidfile=/var/run/${processname}/${processname}.pid RETVAL=0 start() { echo -n $"Starting motion daemon: " daemon --check $servicename $processname -p $pidfile RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename } stop() { echo -n $"Stopping motion daemon: " killproc -p $pidfile $servicename RETVAL=$? echo if [ $RETVAL -eq 0 ]; then rm -f /var/lock/subsys/$servicename rm -f $pidfile fi } # See how we were called. case "$1" in start) start ;; stop) stop ;; status) status -p $pidfile $processname RETVAL=$? ;; restart) stop start ;; condrestart) if [ -f /var/lock/subsys/$servicename ]; then stop start fi ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart}" ;; esac exit $RETVAL