hello, 

the issue when running samba with a non-default config file location is
still there; I've cooked a new solution (for old one see end of message)
and tried to mimic rc.subr(8) shell code style. I failed on the 
``if [[ "X${daemon_flags}" == X*"-s "* ]]; then'' part, though. 

Bye, Marcus

Index: nmbd.rc
===================================================================
RCS file: /cvs/ports/net/samba/pkg/nmbd.rc,v
retrieving revision 1.6
diff -u -r1.6 nmbd.rc
--- nmbd.rc     4 Aug 2012 15:28:14 -0000       1.6
+++ nmbd.rc     13 Sep 2012 09:26:21 -0000
@@ -8,6 +8,17 @@
 
 . /etc/rc.d/rc.subr
 
+if [[ "X${daemon_flags}" == X*"-s "* ]]; then
+       local _word, _dash_s
+       for _word in ${daemon_flags}; do
+               if [ X"${_dash_s}" = X"TRUE" ]; then
+                       smbcontrol="${smbcontrol} -s ${_word}"
+                       break
+               fi
+               [ X"${_word}" == X"-s" ] && _dash_s=TRUE
+       done
+fi
+
 rc_usercheck=NO
 
 rc_check() {
Index: smbd.rc
===================================================================
RCS file: /cvs/ports/net/samba/pkg/smbd.rc,v
retrieving revision 1.6
diff -u -r1.6 smbd.rc
--- smbd.rc     4 Aug 2012 15:28:14 -0000       1.6
+++ smbd.rc     13 Sep 2012 09:26:21 -0000
@@ -8,6 +8,17 @@
 
 . /etc/rc.d/rc.subr
 
+if [[ "X${daemon_flags}" == X*"-s "* ]]; then
+       local _word, _dash_s
+       for _word in ${daemon_flags}; do
+               if [ X"${_dash_s}" = X"TRUE" ]; then
+                       smbcontrol="${smbcontrol} -s ${_word}"
+                       break
+               fi
+               [ X"${_word}" == X"-s" ] && _dash_s=TRUE
+       done
+fi
+
 rc_usercheck=NO
 
 rc_check() {

mcmer-open...@tor.at (MERIGHI Marcus), 2012.04.02 (Mon) 11:56 (CEST):
> when running samba with non-default config file location via the ``-s''
> switch, the smbcontrol(1) utility used in rc.d(8) scripts fails to
> locate the pid files, even when run with the exact same parameters as
> smbd/nmbd. Working around the problem (did not report upstream yet) I
> came up with the patches below (and attached). These use the PID if
> available, instead of names. It does not respect the smb.conf(5) ``pid
> directory (G)'' option.
> 
> bye, Marcus
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> --- smbd.orig Mon Apr  2 11:25:10 2012
> +++ smbd      Mon Apr  2 11:46:19 2012
> @@ -7,17 +7,19 @@
>  . /etc/rc.d/rc.subr
>  
>  smbcontrol="/usr/local/bin/smbcontrol"
> +smbdid="smbd"
> +ls /var/run/smbd*.pid > /dev/null 2>&1 && smbdid=$(cat /var/run/smbd*.pid)
>  
>  rc_check() {
> -     ${smbcontrol} smbd ping
> +     ${smbcontrol} ${smbdid} ping
>  }
>  
>  rc_reload() {
> -     ${smbcontrol} smbd reload-config
> +     ${smbcontrol} ${smbdid} reload-config
>  }
>  
>  rc_stop() {
> -     ${smbcontrol} smbd shutdown
> +     ${smbcontrol} ${smbdid} shutdown
>  }
>  
>  rc_cmd $1
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> --- nmbd.orig Mon Apr  2 11:35:36 2012
> +++ nmbd      Mon Apr  2 11:46:08 2012
> @@ -7,17 +7,19 @@
>  . /etc/rc.d/rc.subr
>  
>  smbcontrol="/usr/local/bin/smbcontrol"
> +nmbdid="nmbd"
> +ls /var/run/nmbd*.pid > /dev/null 2>&1 && nmbdid=$(cat /var/run/nmbd*.pid)
>  
>  rc_check() {
> -     ${smbcontrol} nmbd ping
> +     ${smbcontrol} ${nmbdid} ping
>  }
>  
>  rc_reload() {
> -     ${smbcontrol} nmbd reload-config
> +     ${smbcontrol} ${nmbdid} reload-config
>  }
>  
>  rc_stop() {
> -     ${smbcontrol} nmbd shutdown
> +     ${smbcontrol} ${nmbdid} shutdown
>  }
>  
>  rc_cmd $1
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> 
> 
> !DSPAM:4f7986b7259951333313305!

> --- smbd.orig Mon Apr  2 11:25:10 2012
> +++ smbd      Mon Apr  2 11:46:19 2012
> @@ -7,17 +7,19 @@
>  . /etc/rc.d/rc.subr
>  
>  smbcontrol="/usr/local/bin/smbcontrol"
> +smbdid="smbd"
> +ls /var/run/smbd*.pid > /dev/null 2>&1 && smbdid=$(cat /var/run/smbd*.pid)
>  
>  rc_check() {
> -     ${smbcontrol} smbd ping
> +     ${smbcontrol} ${smbdid} ping
>  }
>  
>  rc_reload() {
> -     ${smbcontrol} smbd reload-config
> +     ${smbcontrol} ${smbdid} reload-config
>  }
>  
>  rc_stop() {
> -     ${smbcontrol} smbd shutdown
> +     ${smbcontrol} ${smbdid} shutdown
>  }
>  
>  rc_cmd $1

> --- nmbd.orig Mon Apr  2 11:35:36 2012
> +++ nmbd      Mon Apr  2 11:46:08 2012
> @@ -7,17 +7,19 @@
>  . /etc/rc.d/rc.subr
>  
>  smbcontrol="/usr/local/bin/smbcontrol"
> +nmbdid="nmbd"
> +ls /var/run/nmbd*.pid > /dev/null 2>&1 && nmbdid=$(cat /var/run/nmbd*.pid)
>  
>  rc_check() {
> -     ${smbcontrol} nmbd ping
> +     ${smbcontrol} ${nmbdid} ping
>  }
>  
>  rc_reload() {
> -     ${smbcontrol} nmbd reload-config
> +     ${smbcontrol} ${nmbdid} reload-config
>  }
>  
>  rc_stop() {
> -     ${smbcontrol} nmbd shutdown
> +     ${smbcontrol} ${nmbdid} shutdown
>  }
>  
>  rc_cmd $1

Reply via email to