1
0
mirror of https://github.com/samba-team/samba.git synced 2025-05-03 02:50:23 +03:00
Gerald Carter 024a46c8fa r9562: successfully get the samba 3 smbtorture working (as a test case for infrastructre)
(This used to be commit c64f5666b8d1f9fb617b1cf89d6157a0c3fa9da9)
2007-10-10 11:01:13 -05:00

83 lines
1.4 KiB
Plaintext

##
## library file for test functions
##
##
## start/stop smbd daemon
##
check_smbd_running()
{
## the smbcontrol ping will return a 0 on success
smbcontrol $CONFIGURATION smbd ping 2>&1 > /dev/null
}
start_smbd()
{
echo "Starting smbd...."
smbd $CONFIGURATION || return $?
sleep 1
smbcontrol $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $?
}
stop_smbd()
{
smbd_pid=`cat $PIDDIR/smbd.pid`
echo "Shutting down smbd (pid $smbd_pid)..."
## belt and braces; first kill and then send a shutdown message
kill -TERM $smbd_pid
smbcontrol $CONFIGURATION smbd shutdown
## check to see if smbd is already running
check_smbd_running
if test $? == 0; then
echo "Unable to stop smbd!"
exit 2
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
}