Am 19.10.2011 17:06, schrieb Frank Lahm:
> 2011/10/19 Reindl Harald <[email protected]>:
>> 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@testserver:~]$ cat /var/lock/cnid_metad
2953
___________________________________________

[root@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@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@testserver:~]$ cat /var/log/messages

[root@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@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@testserver:~]$ systemctl start netatalk.service

[root@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@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@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@testserver:~]$ > /var/log/messages

[root@testserver:~]$ systemctl restart netatalk.service

[root@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@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@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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to