Systemd Startup CentOS 7

Forum for questions and support relating to the 1.27.x releases only.
Locked
snerfu
Posts: 8
Joined: Wed Jun 06, 2012 11:05 pm

Systemd Startup CentOS 7

Post by snerfu »

I've got my cameras running fine, but I can't seem to get the them to start on boot. I have to go into the web interface and change the state to Start to get the cameras running. I made a systemd service and it appears to stop and start all the processes that the web interface does, but the cameras still don't come up. Interestingly, once I change the state in the web interface I can then use the systemd service I made to stop and start the cameras correctly. So I thought there must be something in the database that's getting changed that the systemd service isn't doing, but I logged all the queries and no inserts or updates except to the Log table. Any ideas on what I should look at next?

Processes started by both methods:
apache 4415 0.0 0.5 284924 10504 pts/0 S 12:08 0:00 /usr/bin/perl -wT /usr/local/bin/zmdc.pl startup
apache 4441 2.2 3.0 322044 56480 pts/0 S 12:08 0:26 /usr/local/bin/zmc -m 1
apache 4450 2.0 3.0 323092 57536 pts/0 S 12:08 0:24 /usr/local/bin/zmc -m 2
apache 4459 2.3 3.0 323384 57800 pts/0 S 12:08 0:27 /usr/local/bin/zmc -m 3
apache 4468 0.0 1.1 298380 22480 pts/0 S 12:08 0:00 /usr/bin/perl -wT /usr/local/bin/zmfilter.pl
apache 4476 0.0 0.7 288228 14296 pts/0 S 12:08 0:00 /usr/bin/perl -wT /usr/local/bin/zmaudit.pl -c
apache 4489 0.0 0.6 284520 12784 pts/0 S 12:08 0:00 /usr/bin/perl -wT /usr/local/bin/zmwatch.pl
apache 4499 0.0 0.8 285188 15692 pts/0 S 12:08 0:00 /usr/bin/perl -w /usr/local/bin/zmupdate.pl -c

Here is my systemd service file:
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mariadb.service httpd.service
Requires=mariadb.service httpd.service

[Service]
User=apache
Type=forking
ExecStart=/usr/local/bin/zmpkg.pl start
ExecReload=/usr/local/bin/zmpkg.pl restart
ExecStop=/usr/local/bin/zmdc.pl shutdown
PIDFile="/var/run/zm/zm.pid"

[Install]
WantedBy=multi-user.target
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Systemd Startup CentOS 7

Post by knight-of-ni »

Welcome to the bleeding edge.
Exactly what version of zoneminder are you using and how did you build it (from source)?

Here is the zoneminder.service template to use:
https://github.com/ZoneMinder/ZoneMinde ... service.in
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Systemd Startup CentOS 7

Post by knight-of-ni »

Now that I think about it, the fact that zoneminder didn't build a service file for you tells me that you are probably using 1.27.0, which does not know anything about systemd. Hence your problem.

You should instead build 1.27.99, which represents the latest code and has support for systemd.

Code: Select all

git clone https://github.com/ZoneMinder/ZoneMinder.git
After you make install, look for the service file under the /misc subfolder and copy it into it proper spot.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
Locked