# cat /usr/lib/systemd/system/zoneminder.timer
[Unit]
Description=Start the zoneminder service each day.
[Timer]
OnCalendar=*-*-* 16:00:00
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target
# cat /usr/lib/systemd/system/zoneminder.service
# ZoneMinder systemd unit file for CentOS 7
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mariadb.service httpd.service
Requires=mariadb.service httpd.service
Conflicts=zoneminder-off.service
[Service]
User=apache
Group=apache
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/usr/bin/zmpkg.pl stop
PIDFile=/var/run/zoneminder/zm.pid
Environment=TZ=/etc/localtime
RuntimeDirectory=zoneminder
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
[Unit]
Description=ZoneMinder CCTV recording and security system
After=network.target mariadb.service httpd.service
Requires=mariadb.service httpd.service
Conflicts=zoneminder-off.service
[Service]
User=apache
Group=apache
Type=forking
ExecStart=/usr/bin/zmpkg.pl start
ExecReload=/usr/bin/zmpkg.pl restart
ExecStop=/usr/bin/zmpkg.pl stop
PIDFile=/var/run/zoneminder/zm.pid
Environment=TZ=/etc/localtime
RuntimeDirectory=zoneminder
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target
# cat /usr/lib/systemd/system/zoneminder-off.timer
[Unit]
Description=Stop the zoneminder service each day.
[Timer]
OnCalendar=*-*-* 23:00:00
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target
[Unit]
Description=Stop the zoneminder service each day.
[Timer]
OnCalendar=*-*-* 23:00:00
AccuracySec=24h
Persistent=true
[Install]
WantedBy=timers.target
# cat /usr/lib/systemd/system/zoneminder-off.service
[Unit]Description=Conflict service to cause ZoneMinder to shutdown.
[Service]
Type=oneshot
ExecStart=/bin/echo 'Starting zoneminder-off should shutdown zoneminder.'
ExecReload=/bin/echo 'Reloading zoneminder-off does nothing.'
ExecStop=/bin/echo 'Stopping zoneminder-off does nothing as it is oneshot.'
PIDFile=/var/run/zoneminder/zm-off.pid
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# system enable zoneminder.timer zoneminder.service zoneminder-off.timer zoneminder-off.service
# systemctl start zoneminder.timer zoneminder-off.timer
[Unit]Description=Conflict service to cause ZoneMinder to shutdown.
[Service]
Type=oneshot
ExecStart=/bin/echo 'Starting zoneminder-off should shutdown zoneminder.'
ExecReload=/bin/echo 'Reloading zoneminder-off does nothing.'
ExecStop=/bin/echo 'Stopping zoneminder-off does nothing as it is oneshot.'
PIDFile=/var/run/zoneminder/zm-off.pid
[Install]
WantedBy=multi-user.target
# systemctl daemon-reload
# system enable zoneminder.timer zoneminder.service zoneminder-off.timer zoneminder-off.service
# systemctl start zoneminder.timer zoneminder-off.timer