ports/106436: Samba startup script uses old PID files naming scheme
Rashid N. Achilov
achilov-rn at askd.ru
Thu Dec 7 12:53:23 UTC 2006
The following reply was made to PR ports/106436; it has been noted by GNATS.
From: "Rashid N. Achilov" <achilov-rn at askd.ru>
To: bug-followup at freebsd.org, shelton at master.askd.ru
Cc:
Subject: Re: ports/106436: Samba startup script uses old PID files naming scheme
Date: Thu, 7 Dec 2006 18:43:15 +0600
One more deep analysis shows, that Samba use two naming scheme: one
for 'default' occassion (when config file name = compiled-in name), and this
way PID files will smbd.pid etc. Two for 'non-default' occassion (when config
file name != compiled-in), and this way PID files will smbd-<filename>.pid
etc.
I have developed next patch, which works anyway, when use default config file
and non-default. Patch against samba.in file, not against samba!
--- samba.in.old Thu Dec 7 18:28:25 2006
+++ samba.in Thu Dec 7 18:31:11 2006
@@ -47,6 +47,9 @@
%%WINBIND%%samba_daemons="${samba_daemons} winbindd"
testparm_command="%%PREFIX%%/bin/testparm"
smbcontrol_command="%%PREFIX%%/bin/smbcontrol"
+
+short_cfgname=${samba_config##*/}
+
# Fetch parameters from configuration file
samba_parm="${testparm_command} -s -v --parameter-name"
%%WINBIND%%samba_idmap=$(${samba_parm} 'idmap uid' ${samba_config}
2>/dev/null)
@@ -96,6 +99,17 @@
done
echo " done"
fi
+
+ # We should check - is $samba_config equal to default path
+ # When is it, Samba do not use config file name to create PID files
+ qline=`%%PREFIX%%/smbd -b | grep CONFIG`
+ set $qline
+
+ if [ $samba_config = $2 ]; then
+ pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
+ else
+ pidfile="%%SAMBA_RUNDIR%%/${name}-${short_cfgname}.pid"
+ fi
}
samba_rcvar_cmd() {
@@ -123,7 +137,6 @@
for name in ${samba_daemons}; do
rcvar=$(set_rcvar)
command="%%PREFIX%%/sbin/${name}"
- pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
# Daemon should be enabled and running
if [ -n "${rcvar}" ] && checkyesno ${rcvar}; then
if [ -n "$(check_pidfile "${pidfile}" "${command}")" ]; then
@@ -147,7 +160,6 @@
for name in ${samba_daemons}; do
rcvar=$(set_rcvar)
command="%%PREFIX%%/sbin/${name}"
- pidfile="%%SAMBA_RUNDIR%%/${name}.pid"
run_rc_command "${_rc_prefix}${rc_arg}" ${rc_extra_args}
done
--
With Best Regards.
Rashid N. Achilov (RNA1-RIPE), Web: http://www.askd.ru/~shelton
OOO "ACK" telecommunications administrator, e-mail: achilov-rn [at] askd.ru
PGP: 83 CD E2 A7 37 4A D5 81 D6 D6 52 BF C9 2F 85 AF 97 BE CB 0A
More information about the freebsd-ports-bugs
mailing list