[systemd-devel] Restart=always and "ExecStartPre"

Reindl Harald h.reindl at thelounge.net
Wed Sep 28 08:49:54 PDT 2011


hi

why does systemd not restart a killed service if the "ExecStartPre"-process is
still running, see below - at my opinion after "killall afpd" the service
should be restarted and in a perfect case even if "ExecStartPre"-process dies

systemd-26-10.fc15.x86_64
___________________________

[root at testserver:~]$ cat /lib/systemd/system/netatalk.service
[Unit]
Description=Apple-File-Server
After=syslog.target network.target avahi-daemon.service
[Service]
Type=forking
PIDFile=/var/run/netatalk.pid
ExecStartPre=/usr/sbin/cnid_metad -l log_note
ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target

[root at testserver:~]$ systemctl start netatalk.service

[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-File-Server
          Loaded: loaded (/lib/systemd/system/netatalk.service)
          Active: active (running) since Wed, 28 Sep 2011 17:45:55 +0200; 3s ago
         Process: 2000 ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf (code=exited,
status=0/SUCCESS)
         Process: 1997 ExecStartPre=/usr/sbin/cnid_metad -l log_note (code=exited, status=0/SUCCESS)
        Main PID: 1812 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/netatalk.service
                  ├ 1999 /usr/sbin/cnid_metad -l log_note
                  └ 2002 /usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf

[root at testserver:~]$ cat /var/run/netatalk.pid
2002

[root at testserver:~]$ killall afpd

[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-File-Server
          Loaded: loaded (/lib/systemd/system/netatalk.service)
          Active: active (running) since Wed, 28 Sep 2011 17:45:55 +0200; 35s ago
         Process: 2000 ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf (code=exited,
status=0/SUCCESS)
         Process: 1997 ExecStartPre=/usr/sbin/cnid_metad -l log_note (code=exited, status=0/SUCCESS)
        Main PID: 1812 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/netatalk.service
                  └ 1999 /usr/sbin/cnid_metad -l log_note

[root at testserver:~]$ killall cnid_metad

[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-File-Server
          Loaded: loaded (/lib/systemd/system/netatalk.service)
          Active: active (running) since Wed, 28 Sep 2011 17:46:39 +0200; 1s ago
         Process: 2027 ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf (code=exited,
status=0/SUCCESS)
         Process: 2024 ExecStartPre=/usr/sbin/cnid_metad -l log_note (code=exited, status=0/SUCCESS)
        Main PID: 1812 (code=exited, status=0/SUCCESS)
          CGroup: name=systemd:/system/netatalk.service
                  ├ 2026 /usr/sbin/cnid_metad -l log_note
                  └ 2029 /usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20110928/18e772f3/attachment.pgp>


More information about the systemd-devel mailing list