[Samba] systemd unit to start Samba as AD DC
mathias dufresne
infractory at gmail.com
Thu Nov 12 14:05:51 UTC 2015
Hi all,
Here is my [seem-to-be] working systemd unit to deal with Samba 4.
I'm using Samba 4.3.1 compiled mainly with no option except for
diredctories where I used --enable-fhs (and --prefix=/usr
--sysconfdir=/etc --localstatedir=/var).
samba-ad.service file content
------------------------------------------------------------------------------------
[Unit]
Description=Samba Active Directory Services
Documentation=man:samba(8)
After=network.target
[Service]
Type=forking
PIDFile=/var/run/samba/samba.pid
LimitNOFILE=16384
EnvironmentFile=-/etc/default/samba
ExecStartPre=-/usr/bin/mkdir /var/run/samba
ExecStart=/usr/sbin/samba -D -M standard
ExecReload=/usr/bin/kill -HUP $MAINPID
#FailureAction=
[Install]
WantedBy=multi-user.target
------------------------------------------------------------------------------------
I start from https://dev.tranquil.it/wiki/SAMBA_-_Fichier_systemd_samba4
As the few options used during ./configure made my Samba pid file store in
/var/run/samba I had to force this directory creation at start time using
ExecStartPre.
I kept #FailureAction hoping I figure out what kind of action I could place
there.
For it works I had to place that file in [/usr]/lib/systemd/system then to
enable it via systemctl:
systemctl enable samba-ad.service
Just placing that file in /etc/systemd/system/multi-user.target.wants/ gave
me possibility to launch samba through systemctl but samba was not started
at boot time.
Perhaps that would help someone, perhaps it would be only noise :)
Kindly regards,
mathias
More information about the samba
mailing list