[Samba] several domain

Michael Wood esiotrot at gmail.com
Thu Sep 3 14:13:55 MDT 2009

2009/9/3 azzouz <azzouz at hymedia.univ-paris8.fr>:
> Michael Wood wrote:
>> 2009/9/3 azzouz <azzouz at hymedia.univ-paris8.fr>:
>>> i write instead :
>>> test -x `/usr/sbin/nmbd -D -s $CONFIG_FILE` -a -x `/usr/sbin/smbd -D -s
>>> $CONFIG_FILE` || exit 0
>> This will run nmbd and will probably complain about "test: too many
>> arguments" (same for smbd) because you're supposed to call "test -x"
>> with a filename, and not with the string "smbd version ... Copyright
> in fact it work fine. No complain from smbd

I'm glad you have it working, but that line is wrong anyway :)

"test -x /usr/sbin/smbd" means:
Is the file called /usr/sbin/smbd executable?  It does not run
/usr/sbin/smbd.  It just looks at the file to see if it is executable.

"test -x `/usr/sbin/smbd -D -s $CONFIG_FILE`" means:
Run /usr/sbin/smbd with parameters -D -s $CONFIG_FILE and get the
output.  (The output could be something like "smbd version
3.4.0-GIT-a3e9b62-devel started.
Copyright Andrew Tridgell and the Samba Team 1992-2009" or it could be nothing.)

If the output was "smbd version..." then the test line will expand to:

test -x smbd version...

and you will get an error about "too many arguments".

If the output was blank, then the test line will expand to:

test -x

I'm not sure why, but that does not complain and also returns
"success", so in your case I suspect this is what's happening.

But despite "test" not complaining or failing, that line still starts
smbd and nmbd when it isn't supposed to!  They are supposed to be
started further down in the script.  That line is only to see if they
are executable.

I hope my explanation is clear.

Michael Wood <esiotrot at gmail.com>

More information about the samba mailing list