Preexec and smb.conf

Todd Pfaff pfaff at edge.cis.mcmaster.ca
Wed Oct 20 13:42:12 GMT 1999


On Wed, 20 Oct 1999, Robert Jonsson wrote:

> What I´m trying to do is to create two dirs using preexec in the same
> service. It works well as long as I´m only creating one directory, what I
> can´t figure out is how to create the second directory withing the same
> service. Eg. How would I continue after the last "fi" in the script to
> check for the second directory and create it if it does not exist? 
> 
> preexec = if [ ! -e /home/%U/dir1] then /bin/mkdir /home/%U/dir1; fi 

you may have a syntax error in this '[' (test) command.  make sure there
is a space before the closing ']'.

you can put multiple shell commands separated by semicolons in a preexec,
so you should be able to use something like:

preexec = if [ ! -e /home/%U/dir1 ] then /bin/mkdir /home/%U/dir1; fi;
if [ ! -e /home/%U/dir2 ] then /bin/mkdir /home/%U/dir2; fi 

alternatively:

preexec = [ ! -e /home/%U/dir1 ] && /bin/mkdir /home/%U/dir1;
[ ! -e /home/%U/dir2 ] && /bin/mkdir /home/%U/dir2;

--
Todd Pfaff                         \  Email: pfaff at mcmaster.ca
Computing and Information Services  \ Voice: (905) 525-9140 x22920
ABB 132                              \  FAX: (905) 528-3773
McMaster University                   \
Hamilton, Ontario, Canada  L8S 4M1     \




More information about the samba mailing list