SOURCES: motion.init - use functions
glen
glen at pld-linux.org
Sun Dec 10 13:36:42 CET 2006
Author: glen Date: Sun Dec 10 12:36:42 2006 GMT
Module: SOURCES Tag: HEAD
---- Log message:
- use functions
---- Files affected:
SOURCES:
motion.init (1.4 -> 1.5)
---- Diffs:
================================================================
Index: SOURCES/motion.init
diff -u SOURCES/motion.init:1.4 SOURCES/motion.init:1.5
--- SOURCES/motion.init:1.4 Tue Sep 12 20:26:38 2006
+++ SOURCES/motion.init Sun Dec 10 13:36:37 2006
@@ -18,54 +18,61 @@
# Get service config
[ -f /etc/sysconfig/motion ] && . /etc/sysconfig/motion
+start() {
+ if [ ! -f /var/lock/subsys/motion ]; then
+ msg_starting motion
+ daemon --user motion ${motion} ${STARTUP_OPTIONS}
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] ; then
+ echo `ps axf | grep -v grep | grep ${motion} | head -n1 | awk '{print $1}'` > ${PIDFILE}
+ touch /var/lock/subsys/motion
+ fi
+ else
+ msg_already_running motion
+ fi
+}
+
+stop() {
+ if [ -f /var/lock/subsys/motion ]; then
+ msg_stopping motion
+ killproc --pidfile ${PIDFILE} motion
+ RETVAL=$?
+ rm -f /var/lock/subsys/motion ${PIDFILE}
+ else
+ msg_not_running motion
+ fi
+}
+
RETVAL=0
# See how we were called.
case "$1" in
- start)
- if [ ! -f /var/lock/subsys/motion ]; then
- msg_starting motion
- daemon --user motion ${motion} ${STARTUP_OPTIONS}
- RETVAL=$?
- if [ $RETVAL -eq 0 ] ; then
- echo `ps axf | grep -v grep | grep ${motion} | head -n1 | awk '{print $1}'` > ${PIDFILE}
- touch /var/lock/subsys/motion
- fi
- else
- msg_already_running motion
- fi
- ;;
- stop)
- if [ -f /var/lock/subsys/motion ]; then
- msg_stopping motion
- killproc --pidfile ${PIDFILE} motion
- RETVAL=$?
- rm -f /var/lock/subsys/motion ${PIDFILE}
- else
- msg_not_running motion
- fi
- ;;
- status)
- status motion
+start)
+ start
+ ;;
+stop)
+ stop
+ ;;
+status)
+ status motion
+ RETVAL=$?
+ ;;
+restart|force-reload)
+ stop
+ start
+ ;;
+reload)
+ if [ -f /var/lock/subsys/motion ]; then
+ msg_reloading motion
+ killproc --pidfile ${PIDFILE} motion -HUP
RETVAL=$?
- ;;
- restart|force-reload)
- $0 stop
- $0 start
- exit $?
- ;;
- reload)
- if [ -f /var/lock/subsys/motion ]; then
- msg_reloading motion
- killproc --pidfile ${PIDFILE} motion -HUP
- RETVAL=$?
- else
- msg_not_running motion >&2
- exit 7
- fi
- ;;
- *)
- echo $"Usage: $prog {start|stop|restart|force-reload|reload|status}"
- exit 3
+ else
+ msg_not_running motion
+ exit 7
+ fi
+ ;;
+*)
+ echo $"Usage: $prog {start|stop|restart|force-reload|reload|status}"
+ exit 3
esac
exit $RETVAL
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/motion.init?r1=1.4&r2=1.5&f=u
More information about the pld-cvs-commit
mailing list