[Samba] auto start

Gordon Pritchard gordonp at sfu.ca
Mon Jan 13 21:06:00 GMT 2003


On Mon, 2003-01-13 at 12:52, Roland Thompson wrote:

> Thanks for the reply, but smb isn't one of the options.
> Any idea on how I can get it there?

	If you installed RedHat's samba rpm, everything should be set to
go...???

	If you downloaded and compiled stuff, then I can see this happening. 
What you need is a file - /etc/initd.d/samba  I'm including mine as a
reference for you (also RH 8; short, and ASCII).

====================Begin included samba init====================
#!/bin/sh
#
# chkconfig: 345 91 35
# description: Starts and stops the Samba smbd and nmbd daemons \
#	       used to provide SMB network services.

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

CONFIG=/etc/samba/smb.conf

# Check that smb.conf exists.
[ -f $CONFIG ] || exit 0

# See how we were called.
case "$1" in
  start)
	echo -n "Starting SMB services: "
	daemon smbd -D 	
	daemon nmbd -D 
	echo
	touch /var/lock/subsys/smb
	;;
  stop)
	echo -n "Shutting down SMB services: "

	## we have to get all the smbd process here instead of just the
	## main parent (i.e. killproc) because it can take a long time
	## for an individual process to process a TERM signal
	smbdpids=`ps guax | grep smbd | grep -v grep | awk '{print $2}'`
	for pid in $smbdpids; do
		kill -TERM $pid
	done
	## nmbd is ok to kill using killproc()
	killproc nmbd -TERM
	rm -f /var/lock/subsys/smb
	echo ""
	;;
  status)
	status smbd
	status nmbd
	;;
  restart)
	echo -n "Restarting SMB services: "
	$0 stop
	$0 start
	echo "done."
	;;
  *)
	echo "Usage: smb {start|stop|restart|status}"
	exit 1
esac

==================== End Included Text ====================

-- 
Gordon Pritchard, P.Eng.         | Institute of Electrical and
Research Labs Manager            |      Electronics Engineers
Simon Fraser University, Surrey  | Quarter Century Wireless Ass'n
gordonp at sfu.ca                   | Telephone Pioneers of America
phone:  604.586.6186




More information about the samba mailing list