[systemd-devel] [Netatalk-admins] netatalk: afpd/cnid service
Reindl Harald
h.reindl at thelounge.net
Wed Oct 19 08:44:18 PDT 2011
Am 19.10.2011 17:06, schrieb Frank Lahm:
> 2011/10/19 Reindl Harald <h.reindl at thelounge.net>:
>> Am 19.10.2011 16:44, schrieb Frank Lahm:
>>
>>> cnid_metad writes a PID file too, so I'd add that here and see if that fixes it
>>
>> not really - see "lsof"
>
> it opens, writes and _closes_ the PID file, so of course you won't see
> it in lsof.
>
>> there is also no config-option for PID in the manpages
>> so i do not know what set for "PIDFile" in netalak-cnid.service
>
> look in /var/run or /var/lock
sorry for beeing an idiot :-(
"ExecStopPost" NOT "ExecStartPost"
yes, it needs really the PIDFile-Param
but it is not really as stable/clean as wanted
the first time it fails and will be restarted via "Restart=always"
below my service-files and outputs
hopefully somebody is able to optimize this and provide the other netatalk
services for systemd in a way like this - for my needs it seems to be enough
and pass configurations via config-files and/or "EnvironmentFile="
interesting is that it is not failing always - see at the end outputs from a restart
___________________________________________
Oct 19 17:32:51 testserver systemd[1]: netatalk-cnid.service holdoff time over, scheduling restart.
Oct 19 17:32:51 testserver systemd[1]: PID 2942 read from file /var/lock/cnid_metad does not exist. Your service or
init script might be broken.
[root at testserver:~]$ cat /var/lock/cnid_metad
2953
___________________________________________
[root at testserver:~]$ cat /lib/systemd/system/netatalk-cnid.service
[Unit]
Description=Netatalk CNID
[Service]
Type=forking
PIDFile=/var/lock/cnid_metad
ExecStart=/usr/sbin/cnid_metad -l log_note
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
[root at testserver:~]$ cat /lib/systemd/system/netatalk.service
[Unit]
Description=Apple-Fileserver
After=avahi-daemon.service
[Service]
Type=forking
PIDFile=/var/run/netatalk.pid
ExecStartPre=/bin/systemctl start netatalk-cnid.service
ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf -U uams_dhx.so,uams_dhx2.so -g nobody
ExecStopPost=/bin/systemctl stop netatalk-cnid.service
Restart=always
RestartSec=1
[Install]
WantedBy=multi-user.target
___________________________________________
[root at testserver:~]$ cat /var/log/messages
[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-Fileserver
Loaded: loaded (/lib/systemd/system/netatalk.service)
Active: inactive (dead)
CGroup: name=systemd:/system/netatalk.service
[root at testserver:~]$ systemctl status netatalk-cnid.service
netatalk-cnid.service - Netatalk CNID
Loaded: loaded (/lib/systemd/system/netatalk-cnid.service)
Active: inactive (dead)
CGroup: name=systemd:/system/netatalk-cnid.service
[root at testserver:~]$ systemctl start netatalk.service
[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-Fileserver
Loaded: loaded (/lib/systemd/system/netatalk.service)
Active: active (running) since Wed, 19 Oct 2011 17:32:50 +0200; 3s ago
Process: 2945 ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf -U
uams_dhx.so,uams_dhx2.so -g nobody (code=exited, status=0/SUCCESS)
Process: 2939 ExecStartPre=/bin/systemctl start netatalk-cnid.service (code=exited, status=0/SUCCESS)
Main PID: 2947 (afpd)
CGroup: name=systemd:/system/netatalk.service
└ 2947 /usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf -U
uams_dhx.so,uams_dhx2.so -g nobody -c 100
[root at testserver:~]$ systemctl status netatalk-cnid.service
netatalk-cnid.service - Netatalk CNID
Loaded: loaded (/lib/systemd/system/netatalk-cnid.service)
Active: active (running) since Wed, 19 Oct 2011 17:32:51 +0200; 4s ago
Process: 2951 ExecStart=/usr/sbin/cnid_metad -l log_note (code=exited, status=0/SUCCESS)
Main PID: 2953 (cnid_metad)
CGroup: name=systemd:/system/netatalk-cnid.service
└ 2953 /usr/sbin/cnid_metad -l log_note
[root at testserver:~]$ cat /var/log/messages
Oct 19 17:32:50 testserver afpd[2947]: AFP/TCP started, advertising 84.113.45.81:548 (2-2-1-p1)
Oct 19 17:32:51 testserver systemd[1]: netatalk-cnid.service holdoff time over, scheduling restart.
Oct 19 17:32:51 testserver systemd[1]: PID 2942 read from file /var/lock/cnid_metad does not exist. Your service or
init script might be broken.
___________________________________________
[root at testserver:~]$ > /var/log/messages
[root at testserver:~]$ systemctl restart netatalk.service
[root at testserver:~]$ cat /var/log/messages
Oct 19 17:38:13 testserver afpd[2947]: AFP Server shutting down on SIGTERM
Oct 19 17:38:13 testserver afpd[3044]: AFP/TCP started, advertising 84.113.45.81:548 (2-2-1-p1)
[root at testserver:~]$ systemctl status netatalk.service
netatalk.service - Apple-Fileserver
Loaded: loaded (/lib/systemd/system/netatalk.service)
Active: active (running) since Wed, 19 Oct 2011 17:38:13 +0200; 14s ago
Process: 3034 ExecStopPost=/bin/systemctl stop netatalk-cnid.service (code=exited, status=0/SUCCESS)
Process: 3042 ExecStart=/usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf -U
uams_dhx.so,uams_dhx2.so -g nobody (code=exited, status=0/SUCCESS)
Process: 3037 ExecStartPre=/bin/systemctl start netatalk-cnid.service (code=exited, status=0/SUCCESS)
Main PID: 3044 (afpd)
CGroup: name=systemd:/system/netatalk.service
└ 3044 /usr/sbin/afpd -P /var/run/netatalk.pid -F /etc/netatalk/afpd.conf -U
uams_dhx.so,uams_dhx2.so -g nobody
[root at testserver:~]$ systemctl status netatalk-cnid.service
netatalk-cnid.service - Netatalk CNID
Loaded: loaded (/lib/systemd/system/netatalk-cnid.service)
Active: active (running) since Wed, 19 Oct 2011 17:38:13 +0200; 17s ago
Process: 3038 ExecStart=/usr/sbin/cnid_metad -l log_note (code=exited, status=0/SUCCESS)
Main PID: 3040 (cnid_metad)
CGroup: name=systemd:/system/netatalk-cnid.service
└ 3040 /usr/sbin/cnid_metad -l log_note
-------------- 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/20111019/772c1534/attachment.pgp>
More information about the systemd-devel
mailing list