Page 1 of 1

/etc/rc.d/samba ignores samba_logdir variable

Posted: 15 Dec 2015 05:49
by derailleur
Running embedded 10.2.0.2-2223, I've embarked on a mission to move my log files to a physical drive as a learning exercise for myself. I discovered that even if samba_logdir is set in rc.conf, although it will create the directory at the location specified, smbd.log and nmbd.log are created in /var/log/samba4 regardless. Going by the man page, it appears to me that the /var/log/samba4 location was likely compiled into smbd and nmbd. The logfile location can be over-ridden with the -l=logdirectory command.

I realize I can override the nmdb_flags and smdb_flags from rc.conf, but then there is no point in having the samba_logdir variable.

Fortunately, there is a simple fix, in /etc/rc.c/samba replace

Code: Select all

nmbd_flags="${nmbd_flags=\"-D\"}"
smbd_flags="${nmbd_flags=\"-D\"}"
with

Code: Select all

nmbd_flags="${nmbd_flags=\"-l=${samba_logdir}\"}"
smbd_flags="${nmbd_flags=\"-l=${samba_logdir}\"}"
Alternately, it could be done down where the [global] section of smb.conf is created, but this seemed "easier" to me. :D