I think it would be beneficial to have a variable for lockdir in conf.d. init.d/samba should check for the lockdir location and create it if missing. ### /etc/init.d/samba start() { ${my_service_PRE} [ -d "${piddir}" ] || mkdir -p "${piddir}" [ -d "${lockdir}" ] || mkdir -p "${lockdir}" ### /etc/conf.d/samba daemon_list="smbd nmbd" piddir="/run/samba" lockdir="/tmp/samba"
Forgot to mention the accompanying smb.conf line: ### /etc/samba/smb.conf lock directory = /tmp/samba/locks
And what if a user chagnes the dir in /etc/samba/smb.conf but not in conf.d?
I suppose it is the same issue as if you write some other error in the config file? For example if you put wrong path to the pidfile in conf.d. Otherwise, maybe a more complicated way is to check for the "lock files" line, if exists in smb.conf.