Zoneminder always starts in a stopped state after reboot/shutdown

Forum for questions and support relating to the 1.30.x releases only.
Locked
wdizzle
Posts: 3
Joined: Sun Apr 22, 2018 6:41 pm

Zoneminder always starts in a stopped state after reboot/shutdown

Post by wdizzle »

I always have to open the web UI and change the state to get it to start. I've been using Zoneminder 1.30.0 for over a year now and I have never been able to find a fix for this issue. And YES I have tried the Sleep 15 flag in the config before you say read the FAQs. I've tried increasing it to sleep 30 and even 200. Does anyone have any other ideas? Here is a copy of my /etc/init.d/zoneminder

. /lib/lsb/init-functions

prog=ZoneMinder
ZM_PATH_BIN="/usr/bin"
RUNDIR="/var/run/zm"
TMPDIR="/tmp/zm"
command="$ZM_PATH_BIN/zmpkg.pl"

start() {
echo -n "Starting $prog: "
export TZ=:/etc/localtime
mkdir -p "$RUNDIR" && chown www-data:www-data "$RUNDIR"
mkdir -p "$TMPDIR" && chown www-data:www-data "$TMPDIR"
sleep 15
$command start
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
echo
[ $RETVAL = 0 ] && touch /var/lock/zm
return $RETVAL
}
stop() {
echo -n "Stopping $prog: "
#
# Why is this status check being done?
# as $command stop returns 1 if zoneminder
# is stopped, which will result in
# this returning 1, which will stuff
# dpkg when it tries to stop zoneminder before
# uninstalling . . .
#
result=`$command status`
if [ ! "$result" = "running" ]; then
echo "Zoneminder already stopped"
echo
RETVAL=0
else
$command stop
RETVAL=$?
[ $RETVAL = 0 ] && echo success
[ $RETVAL != 0 ] && echo failure
echo
[ $RETVAL = 0 ] && rm -f /var/lock/zm
fi
}
status() {
result=`$command status`
if [ "$result" = "running" ]; then
echo "ZoneMinder is running"
RETVAL=0
else
echo "ZoneMinder is stopped"
RETVAL=1
fi
}

case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart' | 'force-reload')
stop
start
;;
'status')
status
;;
*)
echo "Usage: $0 { start | stop | restart | status }"
RETVAL=1
;;
esac
exit $RETVAL
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Zoneminder always starts in a stopped state after reboot/shutdown

Post by bbunge »

Linux distro and version?
Locked