Make your own free website on


SMB startup script

Place this script (filename = smb) or one similar to it in /etc/rc.d and create a file in the appropriate runlevel directory call S20smb (and make S20smb a symbolic link to /etc/rc.d/smb)   This script is used by SuSE Linux to start, stop, and restart samba.  Everything in blue I had to modify to point to the new locations of smbd and nmbd when I installed samba-2.0.7.


#! /bin/sh

# Copyright (c) 1996 StarDivision GmbH. All rights reserved.

# Copyright (c) 1996 S.u.S.E. Gmbh Fuerth, Germany. All rights reserved.


# Author: Bastian Epting, StarDivision GmbH <>

# Florian La Roche, <>

# Volker Lendecke, <>


. /etc/rc.config

# Determine the base and follow a runlevel link name.



# Force execution if not called by a runlevel directory.

test $link = $base && START_SMB=yes

test "$START_SMB" = "yes" || exit 0

# The echo return value for success (defined in /etc/rc.config).


case "$1" in


echo -n "Starting SMB services:"

startproc /usr/local/samba/bin/nmbd -D || return=$rc_failed

startproc /usr/local/samba/bin/smbd -D || return=$rc_failed

echo -e "$return"



echo -n "Shutting down SMB services:"

killproc -TERM /usr/local/samba/bin/nmbd || return=$rc_failed

killproc -TERM /usr/local/samba/bin/smbd || return=$rc_failed

echo -e "$return"



$0 stop && $0 start || return=$rc_failed



echo -n "Checking for service smb: "

checkproc /usr/local/samba/bin/nmbd && echo -n "OK " || echo -n "No process "

checkproc /usr/local/samba/bin/smbd && echo "OK " || echo "No process"



echo "Usage: $0 {start|stop|restart|reload|status}"

exit 1


# Inform the caller not only verbosely and set an exit status.

test "$return" = "$rc_done" || exit 1

exit 0



Or use a file similar to the one below and place it in /etc/rc.d and call it something like smbstart.  Use the command: chmod 700 smbstart to make it executable and place a symbolic link ( ln  -s  /etc/rc.d/smbstart  S20smb ) in the correct run level that starts networking support.  (rc3.d for RedHat and rc2.d for SuSE)


# Samba daemon startup script

# filename: /etc/rc.d/smbstart

/usr/local/samba/bin/smbd -D

/usr/local/samba/bin/nmbd -D

echo -n "Starting SaMBa"