BACK

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 <be@stardivision.de>

# Florian La Roche, <florian@suse.de>

# Volker Lendecke, <vl@suse.de>

#

. /etc/rc.config

# Determine the base and follow a runlevel link name.

base=${0##*/}

link=${base#*[SK][0-9][0-9]}

# 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).

return=$rc_done

case "$1" in

start)

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"

;;

stop)

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"

;;

restart|reload)

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

;;

status)

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

esac

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

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

exit 0

#===========================End============================

 

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"

 

BACK