#!/bin/bash
export TERM=linux
. /etc/rc.conf
. /etc/rc.d/functions

while true ; do
    PID=`pidof -x zmdc.pl`
    if test -n "$PID" ; then
        sleep 60
	continue
    fi
    stat_runit "Starting ZoneMinder"
    /etc/rc.d/zm start
    if test $? -ne 0 ; then
        stat_fail
    else
        add_daemon zm
        stat_done
    fi
    sleep 30
done