#!/bin/bash
exec 2>&1

export TERM=linux
MYTH_RUN_STATUS="1"
. /etc/rc.conf
. /etc/rc.d/functions
#wait for mysql
/usr/bin/svwaitup -s 20 /service/mysql

stat_runit "Starting ZoneMinder"
/usr/bin/zmpkg.pl start  2>/tmp/zoneminder.out
rc=$?
if [ $rc = 0 ]
then
   PID=`pidof -x zmdc.pl`
   while [[ -d /proc/$PID ]]
   do
      sleep 45
   done
else
  stat_runit "Zoneminder did not start correctly"
fi





