2003-01-14 19:47:24 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# description: Control ZoneMinder as a Service
|
|
|
|
# chkconfig: 2345 99 99
|
|
|
|
|
2003-01-14 20:37:47 +08:00
|
|
|
# Source function library.
|
|
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
|
|
|
|
prog=ZoneMinder
|
2003-01-14 19:47:24 +08:00
|
|
|
command="@prefix@/bin/zmpkg.pl"
|
|
|
|
|
2003-01-14 20:37:47 +08:00
|
|
|
start() {
|
|
|
|
echo -n "Starting $prog: "
|
2003-01-14 19:47:24 +08:00
|
|
|
$command start
|
2003-01-14 20:37:47 +08:00
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL = 0 ] && echo_success
|
|
|
|
[ $RETVAL != 0 ] && echo_failure
|
|
|
|
echo
|
|
|
|
[ $RETVAL = 0 ] && touch /var/lock/subsys/zm
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
stop() {
|
|
|
|
echo -n $"Stopping $prog: "
|
2003-01-14 19:47:24 +08:00
|
|
|
$command stop
|
2003-01-14 20:37:47 +08:00
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL = 0 ] && echo_success
|
|
|
|
[ $RETVAL != 0 ] && echo_failure
|
|
|
|
echo
|
|
|
|
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/zm
|
|
|
|
}
|
|
|
|
status() {
|
2003-01-14 19:47:24 +08:00
|
|
|
result=`$command status`
|
|
|
|
if [ "$result" = "running" ]; then
|
|
|
|
echo "ZoneMinder is running"
|
2003-01-14 20:37:47 +08:00
|
|
|
RETVAL=0
|
2003-01-14 19:47:24 +08:00
|
|
|
else
|
|
|
|
echo "ZoneMinder is stopped"
|
2003-01-14 20:37:47 +08:00
|
|
|
RETVAL=1
|
2003-01-14 19:47:24 +08:00
|
|
|
fi
|
2003-01-14 20:37:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'start')
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
'stop')
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
'restart')
|
|
|
|
stop
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
'status')
|
|
|
|
status
|
2003-01-14 19:47:24 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 { start | stop | restart | status }"
|
2003-01-14 20:37:47 +08:00
|
|
|
RETVAL=1
|
2003-01-14 19:47:24 +08:00
|
|
|
;;
|
|
|
|
esac
|
2003-01-14 20:37:47 +08:00
|
|
|
exit $RETVAL
|