Page 1 of 1
autorestart
Posted: Sat Mar 03, 2018 11:58 pm
by davic
hi, ZM stops about once a day (tipically at night) and I'm not able to understand why.
How can I get autorestart?
thanks
Re: autorestart
Posted: Sun Mar 04, 2018 12:16 am
by knight-of-ni
You didn't tell us what distro you are running, but it's probably safe to assume your distro is using systemd.
1) Make a copy of your zoneminder.service file and place it into /etc/systemd/system.
This file is typically under /lib/systemd/system for debian & ubuntu and /usr/lib/systemd/system for redhat.
It is important you don't modify the original service file as that will get overwritten during an upgrade.
2) Add the line "restart=always" under the [service] block.
3) Issue a "sudo systemctl daemon-reload && sudo systemctl restart zoneminder" and you are done.
Re: autorestart
Posted: Sun Mar 04, 2018 9:44 am
by davic
thanks very much.
My distro is ubuntu 16.04 server.
I suggest to insert this in the wiki.
thanks again
Re: autorestart
Posted: Sun Mar 04, 2018 4:30 pm
by knight-of-ni
I personally wouldn't add it to the wiki because it doesn't address the real problem of why the service is stopped in the first place.
However, our wiki is community based. Anyone can add content to it, and you are welcome to add this yourself. I certainly won't object.
Re: autorestart
Posted: Sun Mar 04, 2018 7:44 pm
by iconnor
mysql gets restarted for log rotation. This kills zoneminder.
edit
/etc/systemd/system/multi-user.target.wants/zoneminder.service
And change the line with Restart=something
to Restart=always
Re: autorestart
Posted: Sun Mar 04, 2018 8:56 pm
by knight-of-ni
iconnor wrote: ↑Sun Mar 04, 2018 7:44 pm
mysql gets restarted for log rotation. This kills zoneminder.
edit
/etc/systemd/system/multi-user.target.wants/zoneminder.service
And change the line with Restart=something
to Restart=always
Mysql doesn't restart on logrotate on any of the machines I'm running. Just to be sure, I did just check three of them. In addition, If I manually restart mysql, systemd automatically restarts zoneminder as well. ZoneMinder is not left in a stopped state, and I don't have restart=always in my zoneminder service file. It would be interesting to know exactly what cases you've seen this occurring so we can narrow it down to a specific set of conditions that might cause this problem.
Re: autorestart
Posted: Wed Mar 14, 2018 2:02 pm
by Viher
Zoneminder stopping without obvious reason happens here too, and has been happening since I started using Zoneminder (1.28 then 1.30 now) I used to make a cronjob that checked if the ZM was runninng and restarting it if not. Happens once per day, time of day isn't same. I'm using Ubuntu Server 16.04.4 LTS 4.4.0-116.
Thank you knnnigget for the systemd guide.
Re: autorestart
Posted: Wed Mar 14, 2018 2:35 pm
by knight-of-ni
The next time it happens, check your mysql/mariadb logs during the same timeframe to see if your database restarted.
I don't doubt iconnor has seen this happen, but I'm not able to duplicate it. It would be extremely helpful if we could narrow down under what conditions this occurs.
Re: autorestart
Posted: Mon Mar 19, 2018 9:34 pm
by davic
I think something went wrong with log. Zoneminder never stopped but today mysql and ubuntu was not able to work because no space on HD. I found 99% of used space. After analysing all big files I found in /var/log/zm a lot of "zm_debug_log.****" file for about 220 GB.