From 024a46c8fa93a1f219930a329cf7548390a61c2a Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 24 Aug 2005 03:09:49 +0000 Subject: r9562: successfully get the samba 3 smbtorture working (as a test case for infrastructre) (This used to be commit c64f5666b8d1f9fb617b1cf89d6157a0c3fa9da9) --- source3/script/tests/functions | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source3/script/tests/functions') diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 4cc8d4a2c0..40e185e153 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -40,3 +40,43 @@ stop_smbd() fi } + +## +## start/stop smbd daemon +## +check_nmbd_running() +{ + ## the smbcontrol ping will return a 0 on success + smbcontrol $CONFIGURATION nmbd ping 2>&1 > /dev/null +} + +start_nmbd() +{ + echo "Starting nmbd...." + + nmbd $CONFIGURATION || return $? + + sleep 1 + + # smbcontrol $CONFIGURATION `cat $PIDDIR/nmbd.pid` ping 2>&1 > /dev/null || return $? + kill -0 `cat $PIDDIR/nmbd.pid` +} + +stop_nmbd() +{ + nmbd_pid=`cat $PIDDIR/nmbd.pid` + echo "Shutting down nmbd (pid $nmbd_pid)..." + + ## belt and braces; first kill and then send a shutdown message + + kill -TERM $nmbd_pid 2> /dev/null + sleep 1 + + ## check to see if smbd is already running + kill -0 $nmbd_pid 2> /dev/null + if test $? == 0; then + echo "Unable to stop nmbd!" + exit 2 + fi +} + -- cgit