SOURCES: motion.init (NEW), motion.sysconfig (NEW) - init scripts ...

blues blues at pld-linux.org
Thu Mar 23 20:33:11 CET 2006


Author: blues                        Date: Thu Mar 23 19:33:11 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- init scripts for motion - raw, from some distro (don't remember which)

---- Files affected:
SOURCES:
   motion.init (NONE -> 1.1)  (NEW), motion.sysconfig (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/motion.init
diff -u /dev/null SOURCES/motion.init:1.1
--- /dev/null	Thu Mar 23 20:33:11 2006
+++ SOURCES/motion.init	Thu Mar 23 20:33:06 2006
@@ -0,0 +1,84 @@
+#!/bin/bash
+#
+# 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 
+# pidfile: /var/run/motion.pid
+# config: /etc/motion.conf
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+
+
+motion=${MOTION-//usr/bin/motion}
+prog=motion
+PIDFILE=/var/run/motion.pid
+RETVAL=0
+
+
+start() {
+	echo -n $"Starting $prog: "
+	daemon $motion 
+	RETVAL=$?
+	echo `ps axf | grep -v grep | grep  $motion | head -n1 | awk '{print $1}'` > $PIDFILE
+	echo
+	[ $RETVAL = 0 ] && touch /var/lock/subsys/motion
+	return $RETVAL
+}
+stop() {
+	echo -n $"Stopping $prog: "
+	killproc $motion
+	RETVAL=$?
+	echo
+	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/motion /var/run/motion.pid
+}
+stopsafe() {
+	echo -n $"Stopping $prog: ( for restarting ) "
+	killproc $motion
+	RETVAL=$?
+	sleep 10s
+	echo
+	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/motion /var/run/motion.pid
+}
+reload() {
+	echo -n $"Reloading $prog: "
+	killproc $motion -HUP
+	RETVAL=$?
+	echo
+}
+
+# See how we were called.
+case "$1" in
+	start)
+		start
+		;;
+	stop)
+		stop
+		;;
+	status)
+		status $motion
+		RETVAL=$?
+		;;
+	restart)
+		stopsafe
+		start
+		;;
+	condrestart)
+		if [ -f /var/run/motion.pid ] ; then
+			stop
+			start
+		fi
+		;;
+	reload)
+		reload
+		;;
+	*)
+		echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
+		exit 1
+esac
+
+exit $RETVAL

================================================================
Index: SOURCES/motion.sysconfig
diff -u /dev/null SOURCES/motion.sysconfig:1.1
--- /dev/null	Thu Mar 23 20:33:11 2006
+++ SOURCES/motion.sysconfig	Thu Mar 23 20:33:06 2006
@@ -0,0 +1,5 @@
+# Monit startup configuration file
+
+# Try to define nice-level for running monit
+SERVICE_RUN_NICE_LEVEL="+5"
+
================================================================


More information about the pld-cvs-commit mailing list