Delay ZM Service

Post Reply
zemerdon
Site Admin
Posts: 239
Joined: Mon Jan 23, 2023 8:13 pm

Delay ZM Service

Post by zemerdon »

Zoneminder doesn’t start automatically on boot

Check the list for log entries like “zmfix[766]: ERR [Can’t connect to server: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)] “. What can happen is that zoneminder is started too quickly after Mysql and tries to contact the database server before it’s ready. Zoneminder gets no answer and aborts. August 2010 - Ubuntu upgrades seem to be leaving several systems in this state. One way around this is to add a delay to the zoneminder startup script allowing Mysql to finish starting. “Simply adding ‘sleep 15’ in the line above ‘zmfix -a’ in the /etc/init.d/zoneminder file fixed my ZoneMinder startup problems!” - credit to Pada.

We want a small delay on zoneminder’s startup time, to allow MySQL to start before Zoneminder

sudo nano /etc/init.d/zoneminder
Add below: start() {

sleep 15

should look like:

Code: Select all

RUNDIR="/run/zm"
TMPDIR="/tmp/zm"
command="$ZM_PATH_BIN/zmpkg.pl"

start() {
        sleep 120
        echo -n "Starting $prog: "
        export TZ=:/etc/localtime
Ctrl+o Enter to save

CTRL+x to exit
Post Reply