Under some circumstances for debugging purposes it may be helfpfull to
know the PID used during startup as well. Just noted that this one is
only listen in forked mode.
Samba does fork with type=notify as well but systemd is waiting for
sd_notify message in that mode.
Anyway, for curiosity i recompiled samba with --without-systemd.
If i use type=notify mode now and no PIDFile, systemctl start
samba-ad-dc does not start samba but it shows the starte PID. There is
an leftover samba process running whom can be killed with -9.
root at dc1:/srv/packages/jessie# systemctl status samba-ad-dc
● samba-ad-dc.service - Samba AD Daemon
Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
Active: inactive (dead) since Wed 2016-07-13 17:44:08 CEST; 30s ago
Docs: man:samba(8)
man:samba(7)
man:smb.conf(5)
Process: 11641 ExecStart=/usr/sbin/samba $SAMBAOPTIONS (code=exited,
status=0/SUCCESS)
Main PID: 11641 (code=exited, status=0/SUCCESS)
With an proper PIDFile line, samba starts but systemctl start
samba-ad-dc must be CTRL-C'ed. No starter PID is shown. Samba itself works.
● samba-ad-dc.service - Samba AD Daemon
Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
Active: activating (start) since Wed 2016-07-13 17:46:05 CEST; 1min
25s ago
Docs: man:samba(8)
man:samba(7)
man:smb.conf(5)
Main PID: 11812 (samba)
CGroup: /system.slice/samba-ad-dc.service
├─11812 /usr/sbin/samba
├─11813 /usr/sbin/samba
├─11814 /usr/sbin/samba
├─11815 /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
├─11816 /usr/sbin/samba
├─11817 /usr/sbin/samba
├─11818 /usr/sbin/samba
├─11819 /usr/sbin/samba
├─11820 /usr/sbin/samba
├─11821 /usr/sbin/samba
├─11822 /usr/sbin/samba
├─11823 /usr/sbin/samba
├─11824 /usr/sbin/winbindd -D --option=server role
check:inhibit=yes --foreground
├─11825 /usr/sbin/samba
├─11826 /usr/sbin/samba
├─11829 /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
├─11830 /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
├─11832 /usr/sbin/smbd -D --option=server role
check:inhibit=yes --foreground
└─11834 /usr/sbin/winbindd -D --option=server role
check:inhibit=yes --foreground
Forked mode works like it did with --with-systemd.
So if samba(-ad-dc).service does not start with type=notify, it must be
build with --with-systemd.
If system-ctl start samba(-ad-dc) must be killed with CTRL-D can be
caused by type=forked and wrong PIDFile or by type=notify with the
correct PIDFile but no systemd support compiled in. :-)
Am 13.07.2016 um 15:27 schrieb Reindl Harald:>
>
> Am 13.07.2016 um 15:19 schrieb Achim Gottinger:
>> Am 13.07.2016 um 12:09 schrieb Reindl Harald:
>>> Main PID: 8749 (samba)
>>>
>> Was talking about "Process 8590" whom invokes 8591 and exitst
>> afterwards.
>> This one is only listed on forked mode status
>
> what else do you expect than not forked mode?
> the only interesting for systemd is the main-pid in any mode
>
> http://stackoverflow.com/questions/10932592/why-fork-twice
> http://code.activestate.com/recipes/66012-fork-a-daemon-process-on-unix/
>
>
>
If indeed it generally works either way, that is with Type=fork and Type=notify is one actually preferable than the other? As I posted earlier - systemd says: "If set to forking, it is expected that the process configured with ExecStart= will call fork() as part of its start-up. The parent process is expected to exit when start-up is complete and all communication channels are set up. The child continues to run as the main daemon process. This is the behavior of traditional UNIX daemons." Does the above actually occur with the nmbd, smbd, and samba binaries? IOW, do they act, in this sense, like traditional UNIX daemons? If so, maybe Type=fork is the preferred method, if not, maybe Type=notify should be used. Chris
Am 13.07.2016 um 18:37 schrieb Sonic:> If indeed it generally works either way, that is with Type=fork and > Type=notify is one actually preferable than the other? > > As I posted earlier - systemd says: > "If set to forking, it is expected that the process configured with > ExecStart= will call fork() as part of its start-up. The parent > process is expected to exit when start-up is complete and all > communication channels are set up. The child continues to run as the > main daemon process. This is the behavior of traditional UNIX > daemons." > > Does the above actually occur with the nmbd, smbd, and samba binaries? > IOW, do they act, in this sense, like traditional UNIX daemons? If so, > maybe Type=fork is the preferred method, if not, maybe Type=notify > should be used. > > ChrisThe advantage of the notify mode is that the samba binary decides if it has succesfully started. It depends on working systemd-notify environment and builtin systemd support in samba. Found an older bug reports about systemd-notify and lxc. https://lists.freedesktop.org/archives/systemd-bugs/2014-March/002416.html