Some of the features which are part of systemd are relevant here.
Your zoneminder service file, probably has the following line in it:
Code: Select all
Requires=mysqld.service httpd.service
What that means is that ZoneMinder will not start unless mysql and http services are started. Unlike the former sys v init, systemd takes that a step further and will start these services for you automatically if they are not already running. If you try to restart mysql or http service, systemd will automatically restart zoneminder. Nice. This fixes a long standing issue where the end user would restart mysql, but forget to restart zoneminder which leaves zoneminder in a failed state.
Keep in mind, however, this feature of systemd also means that, if mysql were to fail for any reason, systemd would automatically shutdown zoneminder the moment mysql failed. This is why iconnor eluded to the fact that you should monitor your mysql server because a failed mysql would certainly account for zoneminder stopping abruptly .
Another feature of systemd might come in handy as well, but I am hesitant to tell you because even though it might make the problem appear to go away, it won't get us any closer to learning the root cause of the problem.
See the systemd documentation:
https://www.freedesktop.org/software/sy ... l#Restart=
If you add the line "Restart=always" to your zoneminder service file (don't forget to tell systemd to reload its daemon config), and possibly your mysql service file, then systemd will attempt to restart these services if they stop for any reason. Note, however, if mysql fails in a way that makes it un-startable, then zoneminder will still fail to restart as well.