[oe] [meta-networking][PATCH 15/17] samba: start on boot with systemd

Koen Kooi koen at dominion.thruhere.net
Wed Nov 30 13:37:47 UTC 2016


Op 30-11-16 om 13:53 schreef Andreas Oberritter:
> On 30.11.2016 13:24, Koen Kooi wrote:
>> Op 30-11-16 om 13:04 schreef Andreas Oberritter:
>>> Signed-off-by: Andreas Oberritter <obi at opendreambox.org>
>>> ---
>>>  meta-networking/recipes-connectivity/samba/samba_4.4.5.bb | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/meta-networking/recipes-connectivity/samba/samba_4.4.5.bb b/meta-networking/recipes-connectivity/samba/samba_4.4.5.bb
>>> index c2bbb97..b781f7c 100644
>>> --- a/meta-networking/recipes-connectivity/samba/samba_4.4.5.bb
>>> +++ b/meta-networking/recipes-connectivity/samba/samba_4.4.5.bb
>>> @@ -36,6 +36,10 @@ SYSVINITTYPE = "sysv"
>>>  INITSCRIPT_NAME = "samba"
>>>  INITSCRIPT_PARAMS = "start 20 3 5 . stop 20 0 1 6 ."
>>>  
>>> +SYSTEMD_PACKAGES = "${PN}-base winbind"
>>> +SYSTEMD_SERVICE_${PN}-base = "nmb.service smb.service"
>>> +SYSTEMD_SERVICE_winbind = "winbind.service"
>>
>> Do these actually work nowadays? When I tried it recently I had to change the
>> units into this to actually start:
> 
> Yes, it works for me.

Great!

> 
>> # cat /lib/systemd/system/smb.service
>> [Unit]
>> Description=Samba SMB Daemon
>> After=syslog.target network.target nmb.service winbind.service
>>
>> [Service]
>> Type=simple
>> LimitNOFILE=16384
>> EnvironmentFile=-/etc/sysconfig/samba
>> ExecStart=/usr/sbin/smbd $SMBDOPTIONS
>> ExecReload=/bin/kill -HUP $MAINPID
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> And worse, samba fails to start if there's no network interface up, so I start
>> smb.service using this timer to avoid races:
>>
>> # cat /lib/systemd/system/smb.timer
>> [Unit]
>> Description=Samba timer
>>
>> [Timer]
>> # Time to wait after booting before we run first time
>> OnBootSec=2min
>> Unit=smb.service
>>
>> [Install]
>> WantedBy=multi-user.target
> 
> I can reproduce this. It would be easier to depend on network-online.target.

That thought crossed me mind as well, but I haven't tried it yet.

regards,

Koen





More information about the Openembedded-devel mailing list