new functionality audit / restart when random stop occurs

Forum for questions and support relating to the 1.29.x releases only.
Post Reply
AnotherBrian
Posts: 103
Joined: Tue Jul 27, 2010 6:36 am

new functionality audit / restart when random stop occurs

Post by AnotherBrian » Sun Apr 16, 2017 5:36 pm

An occasional issue has been that zoneminder stops seemly at random times.
The condition is not detected by the user unless he happens to visit the zoneminder screen.
This means that the system will have been down for extended periods of time.
Upon restart, zoneminder seems to be fully functioning.

Regardless of the source of the problem it seems like it has been an issue for some people through many releases.

On mission critical systems it is the norm that audit functionality exists and action is under taken by the system when certain conditions exist.

It would seem easy to have a configurable option to have a process monitor the state of zoneminder and when a non-user initiated stop occurs, to issue a restart.

I've seen the recommendation of rebooting periodically but that still results in a loss of some data.

User avatar
iconnor
Posts: 1228
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: new functionality audit / restart when random stop occurs

Post by iconnor » Mon Apr 17, 2017 2:50 am

The recommendation is to use monit, or tell systemd to keep zm running.

If you have a better idea, then we eagerly await your pull request.

AnotherBrian
Posts: 103
Joined: Tue Jul 27, 2010 6:36 am

Re: new functionality audit / restart when random stop occurs

Post by AnotherBrian » Mon Apr 17, 2017 4:48 pm

I will look at these. Thx!

AnotherBrian
Posts: 103
Joined: Tue Jul 27, 2010 6:36 am

Re: new functionality audit / restart when random stop occurs

Post by AnotherBrian » Wed Apr 26, 2017 7:29 pm

Here is how to do it on linux systems using systemd as the init manager. Systemd is on many linux systems and inparticular on ubuntu 15.04 forward..

Edit file /etc/systemd/system/multi-user.target.wants/zoneminder.service making a change to Restart:

Code: Select all

#Restart=on-abnormal
Restart=always
Now let the init manager know you made a change:

Code: Select all

systemctl daemon-reload
To test, get the process number using service status and kill it. Then redo the status to see it restarted.

Code: Select all

service zoneminder status

Code: Select all

zoneminder.service - ZoneMinder CCTV recording and surveillance system
Loaded: loaded (/lib/systemd/system/zoneminder.service; enabled; vendor prese
Active: active (running) since Wed 2017-04-26 15:04:51 EDT; 16min ago
Process: 9980 ExecStop=/usr/bin/zmpkg.pl stop (code=exited, status=0/SUCCESS)
Process: 10074 ExecStart=/usr/bin/zmpkg.pl start (code=exited, status=0/SUCCES
Main PID: 10090 (zmdc.pl)
CGroup: /system.slice/zoneminder.service
           ├─10090 /usr/bin/perl -wT /usr/bin/zmdc.pl startup
           ├─10167 /usr/bin/zmc -m 4
           ├─10168 /usr/bin/zma -m 4
           ├─10169 /usr/bin/zmc -m 2
           ├─10170 /usr/bin/zmc -m 3
           ├─10172 /usr/bin/zmc -m 5
           ├─10175 /usr/bin/zmc -m 1
           ├─10178 /usr/bin/zma -m 2
           ├─10181 /usr/bin/zma -m 5
           ├─10197 /usr/bin/zmc -m 6
           ├─10205 /usr/bin/zma -m 6
           ├─10207 /usr/bin/zmc -m 7
           ├─10215 /usr/bin/perl -wT /usr/bin/zmfilter.pl
           ├─10221 /usr/bin/zma -m 7
           ├─10222 /usr/bin/perl -wT /usr/bin/zmaudit.pl -c
           ├─10227 /usr/bin/perl -wT /usr/bin/zmwatch.pl

Code: Select all

kill -9 10090

AnotherBrian
Posts: 103
Joined: Tue Jul 27, 2010 6:36 am

Re: new functionality audit / restart when random stop occurs

Post by AnotherBrian » Wed Apr 26, 2017 7:32 pm

So the question is - should zoneminder incorporate the above change so that it always restarts when it crashes.

Voice your opinion - I think it should be included.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests