1997-09-05 06:28:41 +04:00
#! /bin/sh
#
# Samba server control
#
IS_ON=/etc/chkconfig
KILLALL=/sbin/killall
SAMBAD=/usr/samba/bin/smbd
2004-03-16 22:43:04 +03:00
PROFILE_SAMBAD=/usr/samba/bin/smbd.profile
1997-09-05 06:28:41 +04:00
#SAMBA_OPTS=-d2
NMBD=/usr/samba/bin/nmbd
2004-03-16 22:43:04 +03:00
PROFILE_NMBD=/usr/samba/bin/nmbd.profile
1997-09-05 06:28:41 +04:00
#NMBD_OPTS=-d1
2004-03-16 22:43:04 +03:00
SMBCONTROL=/usr/samba/bin/smbcontrol
1997-09-05 06:28:41 +04:00
if test ! -x $IS_ON ; then
IS_ON=true
fi
if $IS_ON verbose ; then
ECHO=echo
else # For a quiet startup and shutdown
ECHO=:
fi
2004-03-16 22:43:04 +03:00
if $IS_ON sambaprofiling ; then
enable_profiling=yes
fi
if test "$enable_profiling" -o "$1" = "profile" ; then
SAMBAD=$PROFILE_SAMBAD
NMBD=$PROFILE_NMBD
enable_profiling="yes"
fi
1997-09-05 06:28:41 +04:00
case $1 in
2004-03-16 22:43:04 +03:00
start|profile)
1997-09-05 06:28:41 +04:00
if $IS_ON samba && test -x $SAMBAD; then
2004-03-16 22:43:04 +03:00
/etc/init.d/samba stop
1997-09-05 06:28:41 +04:00
$ECHO "Samba:\c"
$SAMBAD $SAMBA_OPTS -D; $ECHO " smbd\c"
$NMBD $NMBD_OPTS -D; $ECHO " nmbd\c"
$ECHO "."
fi
2004-03-16 22:43:04 +03:00
if $IS_ON samba && test "$enable_profiling" ; then
if test -x $SMBCONTROL; then
$ECHO "Enabling Samba profiling."
$SMBCONTROL smbd profile on > /dev/null 2>&1
$SMBCONTROL nmbd profile on > /dev/null 2>&1
fi
$KILLALL -HUP pmcd
fi
1997-09-05 06:28:41 +04:00
;;
2004-03-16 22:43:04 +03:00
stop)
1997-09-05 06:28:41 +04:00
$ECHO "Stopping Samba Servers."
$KILLALL -15 smbd nmbd
2004-03-16 22:43:04 +03:00
$KILLALL -15 smbd.profile nmbd.profile
$KILLALL -15 pmdasamba
1998-12-07 23:27:01 +03:00
exit 0
1997-09-05 06:28:41 +04:00
;;
*)
2004-03-16 22:43:04 +03:00
echo "usage: /etc/init.d/samba {start|stop|profile}"
1997-09-05 06:28:41 +04:00
;;
esac