Click to See Complete Forum and Search --> : Samba not starting up


Jnaslund
11-26-2001, 05:28 PM
On my redhat 7.1 linux box samba is not starting up with the machine. I always have to go to /etc/rc.d/init.d and do "./smb start" What gives?

soleblazer
11-26-2001, 05:53 PM
Is it in any of the rcx.d folders? It should be in rc3.d. It must also start with a S for the name of the file like S99samba, the run level script will pick it up and exec it.

Jnaslund
11-26-2001, 07:19 PM
Ok, its not there so how do I get it there? Just copy the smb file from /etc/rc.d/init.d (I'm a newbie I dont know what I'm doing)

bdg1983
11-27-2001, 04:06 AM
Are you sure that Redhat 7.1 does not automatically create a Samba startup script in /etc/init.d?

/etc/init.d/samba
and a link to
/etc/init.d/rc3.d/S40Samba

Here is my /etc/init.d/samba (from Caldera Workstation 3.1) though it could be somewhat different from what yours should be.

#!/bin/bash
#
#
### BEGIN INIT INFO
# Provides: $samba
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: samba
# Starts and stops the Samba smbd and nmbd daemons
# used to provide SMB network services.
### END INIT INFO
#
# Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for OpenLinux by Raymund Will <ray@caldera.de>
# Adapted for samba by Klaus Singvogel <klaus@caldera.de>

NAME_S=smbd
DAEMON_S=/usr/sbin/$NAME_S
NAME_N=nmbd
DAEMON_N=/usr/sbin/$NAME_N
NAME_W=winbindd
DAEMON_W=/usr/sbin/$NAME_W

config_file=/etc/samba.d/smb.conf

# Source function library (and set vital variables).
. /etc/rc.d/init.d/functions

status() {
[ -e $1 ] || return 3; # lock / pid file doesn't exist, seems to be stopped

i=`cat "$1"`
state=`egrep '^State' /proc/$i/status 2>/dev/null| sed 's#.* \(.\).*#\1#'`
if [ x$state = x -o x$state = xZ ]; then
return 2 # no such process (or zombie) --> dead
fi
return 0 # seems to be up and running
}

# this function is dedicated to Jan Terpstra. -- Klaus Singvogel, Sep. 2001.
WinbdConfig() {
# returns 0 if winbindd is not configured,
# and 1 if winbindd is configured.

local config_file=$1; shift # file to check

# check if "winbind uid" is set in samba config file
egrep -q '[^#]*winbind uid' $config_file || return 0

found=0;
# We also need to check if least one PAM module control file does
# NOT have pam_winbind.so commented out
for i in /etc/pam.d/*; do
if [ ! -f $i ]; then next; fi
egrep -q '[^#]*pam_winbind.so' $i && found=1 && break;
done

if [ $found != 0 ]; then
# if so, ensure that in /etc/nsswitch.conf we have for
# "passwd", "shadow", "group" an entry for "winbind"
egrep -q '^passwd:.*winbind' /etc/nsswitch.conf && return 1
egrep -q '^shadow:.*winbind' /etc/nsswitch.conf && return 1
egrep -q '^group:.*winbind' /etc/nsswitch.conf && return 1
fi

return 0
}

case "$1" in
start)
[ ! -e $SVIlock ] || exit 0
[ -x $DAEMON_S -a -x $DAEMON_N ] || exit 5
SVIemptyConfig $config_file && exit 6

echo -n "Starting $SVIsubsys services: "
ssd -S -n $NAME_S -x $DAEMON_S -- $OPTIONS_SMB
WinbdConfig $config_file || ssd -S -n $NAME_W -x $DAEMON_W -- $OPTIONS_WINBD
ssd -S -n $NAME_N -x $DAEMON_N -- $OPTIONS_NMB
ret=$?

echo "."
touch $SVIlock
;;

stop)
[ -e $SVIlock ] || exit 0

echo -n "Stopping $SVIsubsys services: "
ssd -K -p /var/lock/samba.d/$NAME_S.pid -n $NAME_S #-x $DAEMON_S
ssd -K -p /var/lock/samba.d/$NAME_W.pid -n $NAME_W #-x $DAEMON_W
ssd -K -p /var/lock/samba.d/$NAME_N.pid -n $NAME_N #-x $DAEMON_N

ret=$?

echo "."
rm -f $SVIlock
;;

force-reload)
[ -e $SVIlock ] || exit 0
$0 restart
ret=$?
;;

reload)
echo -n "Reloading $SVIsubsys service configuration: "
# nmbd has no config file to reload
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_N.pid -n $NAME_N #-x $DAEMON_N
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_W.pid -n $NAME_W #-x $DAEMON_W
ssd -K --signal 1 -p /var/lock/samba.d/$NAME_S.pid -n $NAME_S #-x $DAEMON_S
ret=$?
echo "."
;;

restart)
$0 stop
$0 start
ret=$?
;;

status)
echo -n "Checking status of $SVIsubsys service: "
status /var/lock/samba.d/$NAME_N.pid
ret=$?
if [ $ret -eq 0 ]; then
echo -n "$NAME_N "
status /var/lock/samba.d/$NAME_S.pid
ret=$?
[ $ret -eq 0 ] && echo -n "$NAME_S"
fi
echo "."
;;

*)
echo "Usage: $SVIscript {start|stop|restart|force-reload|reload|status}"
ret=2
;;

esac

exit $ret

StanLin
11-27-2001, 11:23 AM
Have you tried running ntsysv or chkconfig?

teeitup
11-27-2001, 01:03 PM
Samba can be run two ways. As a Daemon or from inetd.

As a daemon it would always be running. Running it from inet would load on demand.

If you enter this at the cli, what is your output?
ps -ef | grep smb

Distros are not the same when it comes to starting services.
http://www.oreilly.com/catalog/samba/chapter/book/appd_01.html

Good Luck,