The systemd service file was written with an old init-style dependency on daemonize which isn't needed at all, and actually didn't quite work as intended when stopping the service. Everything that daemonize does is built into systemd already. This as now written will run on any systemd-based OS (debian, ubuntu, centos, redhat, etc) and is a little more secure and reliable.
-u locast2plex is covered by User and Group
-c /opt/locast2plex is covered by WorkingDirectory
-a (append to output files) is unnecessary... no output files are created.
-o /var/log/locast2plex.log -e /var/log/locast2plex.log is covered by writing to syslog / system journal.
-p /var/run/locast2plex/locast2plex.pid is not needed if we're not forking. (Type=Simple runs as a direct child of init)
-l /var/run/locast2plex/locast2plex.lock to prevent multiple instances running is handled much cleaner and more reliably by systemd.
Increase security with ProtectSystem, ProtectHome and PrivateTmp.
Systemd will reliably kill the process with SIGTERM and eventually SIGKILL if it gets stuck.
Systemd will restart it on any abnormal exit.
Gets rid of an unnecessary dependency (daemonize) that is not installed by default on modern systems.
The systemd service file was written with an old init-style dependency on
daemonize
which isn't needed at all, and actually didn't quite work as intended when stopping the service. Everything that daemonize does is built into systemd already. This as now written will run on any systemd-based OS (debian, ubuntu, centos, redhat, etc) and is a little more secure and reliable.-u locast2plex
is covered byUser
andGroup
-c /opt/locast2plex
is covered byWorkingDirectory
-a
(append to output files) is unnecessary... no output files are created.-o /var/log/locast2plex.log -e /var/log/locast2plex.log
is covered by writing to syslog / system journal.-p /var/run/locast2plex/locast2plex.pid
is not needed if we're not forking. (Type=Simple
runs as a direct child of init)-l /var/run/locast2plex/locast2plex.lock
to prevent multiple instances running is handled much cleaner and more reliably by systemd.ProtectSystem
,ProtectHome
andPrivateTmp
.Thanks!