How to restart Samba conveniently - A better way

Steve Litt slitt at
Tue Oct 19 21:03:28 GMT 1999

The retrofit method I posted an hour ago modifies
/etc/rc.d/init.d/functions, which is a group of utility functions used by
all the start/stop scripts. It's probably a bad idea to modify it.

So instead, make all the mods in /etc/rc.d/init.d/smb. First, right after
smb calls functions (. /etc/rc.d/init.d/functions), place this line to add
a path to the Samba executables:


Then, change the line that checks for smb.conf ([ -f /etc/smb.conf ] || exit 0
) to the correct location of smb.conf:

[ -f /usr/local/samba/lib/smb.conf ] || exit 0  

That's it. Start, stop, and restart Samba with a single command, even when
the new installation differs from Red Hat's.

Steve Litt

At 06:04 AM 10/20/1999 +1000, you wrote:
>Hi everyone -- thanks for the help
>I've found the method to retrofit Red Hat's /etc/rc.d/init.d/smb to the new
>directory structure. First a copy of /etc/rc.d/init.d/smb must be obtained
>from a default Red Hat installation. In addition, your setup must have file
>/etc/rc.d/init.d/functions, which is a set of utility shellscript routines.
>Each of these two files requires exactly one line change:
>*** /etc/rc.d/init.d/smb ***
>There's a line that checks for the existence of smb.conf and exits if not:
>[ -f /etc/smb.conf ] || exit 0
>That line must be changed to the new location:
>[ -f /usr/local/samba/lib/smb.conf ] || exit 0
>*** /etc/rc.d/init.d/functions ***
>Near the top there's a line that exports a default path:
>export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"
>To that line must be appended the Samba binary directory:
>Once these two changes have been accomplished, the following commands
>reliably start, stop and restart Samba:
>/etc/rc.d/init.d/smb start
>/etc/rc.d/init.d/smb stop
>/etc/rc.d/init.d/smb restart
>Your mileage may vary. Please let me know if it does.
>There are similar shellscripts in Caldera and Debian default Samba setups,
>so they probably can be similarly retrofitted.
>Steve Litt
>At 03:57 AM 10/20/1999 +1000, you wrote:
>>I just downloaded and installed the source to 2.0.5a, and it worked
>>perfectly. I really like the fact that everything by default goes under
>>/usr/local/samba (I just did the ./configure; make; make install).
>>The one thing I don't see is the start/stop/restart commands like I used to
>>have in my Red Hat rpm installation:
>>/etc/rc.d/init.d/smb restart
>>It was a shellscript to read the .pid files, stop, start or stop and start
>>smbd and nmbd depending on the argument. Is there such a thing included in
>>2.0.5a compiled from source, and if not, what's the best way for me to
>>"roll my own".
>>Steve Litt

More information about the samba mailing list