SOLUTION: Start/Stop Samba (was: Password verification for remote printing)

SI-Gaetan Boudreau boudreg at IRCM.UMontreal.CA
Thu Feb 12 14:39:55 GMT 1998


> Date: Wed, 11 Feb 1998 09:55:37 -0700 (MST)
> From: Kitty Ferguson <ferguson at jabba.hao.ucar.edu>
> To: samba at anu.edu.au

> Is there a way to stop and restart the Samba server without rebooting 
the 
> machine? 

> --Kitty Ferguson		System Administrator - CSMT
> ferguson at hao.ucar.edu		NCAR - High Altitude Observatory	
> tel: (303)497-1556		P.O. Box 3000
> fax: (303)497-1589		Boulder, CO 80307-3000


Of course there is a way to start/stop Samba without rebooting.

This is describe somewhre in the doc of Samba.

The best way for a SysV is this:

Make a symbolic link in /etc/rc3.d to /etc/init.d from the file 
S99samab.server to the file samba.server:
lrwxrwxrwx 1 root  other   24 Jun 27  1997 /etc/rc3.d/S99samba.server -> 
/etc/init.d/samba.server*

Here is the content of the file (taken from the Samba doc)
(replace the /opt/samba/bin path by yours)
terre{root}: cat /etc/init.d/samba.server
#!/bin/sh
#ident  "@(#)samba.server 1.0   96/06/19 TK"    /* SVr4.0 1.1.13.1*/
#
# Please send info on modifications to knuutila at cs.utu.fi
#
# This file should have uid root, gid sys and chmod 744
#
if [ ! -d /usr/bin ]
then                    # /usr not mounted
        exit
fi

killproc() {            # kill the named process(es)
        pid=`/usr/bin/ps -e |
             /usr/bin/grep -w $1 |
             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill $pid
}

# Start/stop processes required for samba server

case "$1" in

'start')
   echo "Starting SAMBA Services: "
      /opt/samba/bin/smbd -D
   echo "   smbd Started"
      /opt/samba/bin/nmbd -D
   echo "   nmbd Started"          
   ;;
'stop')
   echo "Stoping SAMBA Services: "
      killproc nmbd
   echo "   nmbd Stopped"
      killproc smbd
   echo "   smbd Stopped"
   ;;
*)
   echo "Usage: /etc/init.d/`basename $0` { start | stop }"
   ;;
esac


This will accomplish 2 things:
1) start automatically samba at boot.
2) allow tou to start/stop samba at will with these commands:
   /etc/init.d/samba.server stop
   /etc/init.d/samba.server start

Another note:
Most of the parameters of the smb.conf file I read on the fly and you 
don't have to restart Samba.

Hope this help.

-- 
====================================================
Gaetan Boudreau, ing/P.Eng.                       
Administrateur de reseau/Network Administrator
IRCM (Institut de recherches cliniques de Montreal/
      Clinical Research Institute of Montreal)

tel: 514-987-5563   fax: 514-987-5644
Internet E-Mail: Gaetan_Boudreau at IRCM.UMontreal.CA
Internet Web Site: http://www.ircm.umontreal.ca


More information about the samba mailing list