From 01632f9cb1746d066af3826816fc4518494e08d7 Mon Sep 17 00:00:00 2001 From: zador-blood-stained Date: Tue, 11 Apr 2017 20:24:21 +0300 Subject: [PATCH] Update service dependencies to start on early boot This changes log2ram dependencies to start as early as possible, before other services that may require access to /var/log, including rsyslog and systemd-journald. Additional dependencies on shutdown.target are required to ensure that the service will be stopped at shutdown/reboot when DefaultDependencies is set to "no" [1]. RequiresMountsFor declares dependency on /var mount when it is a mount point. IgnoreOnIsolate prevents stopping the service when isolating another unit. [1]: https://www.freedesktop.org/software/systemd/man/systemd.service.html --- log2ram.service | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/log2ram.service b/log2ram.service index eab3643..14d452a 100644 --- a/log2ram.service +++ b/log2ram.service @@ -1,6 +1,11 @@ [Unit] Description=Log2Ram -Before=syslog.target mysql.service fail2ban.service nginx.service rsyslog.service +DefaultDependencies=no +Before=rsyslog.service syslog.target systemd-journald.service sysinit.target shutdown.target +After=local-fs.target +Conflicts=shutdown.target +RequiresMountsFor=/var/log /var/log.hdd +IgnoreOnIsolate=yes [Service] Type=oneshot @@ -10,4 +15,4 @@ ExecReload= /usr/local/bin/log2ram write RemainAfterExit=yes [Install] -WantedBy=multi-user.target +WantedBy=sysinit.target