diff options
author | Gerald Carter <jerry@samba.org> | 2005-08-23 22:10:44 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:01:12 -0500 |
commit | 35f12fd94db0b89d6670945f6f27c3b8d316118b (patch) | |
tree | 3782973219eb057a485154060dc3d2c2b00f8c61 /source3/script/tests/functions | |
parent | b67ba1e36b11aa140822f92b148438a1387d4d9d (diff) | |
download | samba-35f12fd94db0b89d6670945f6f27c3b8d316118b.tar.gz samba-35f12fd94db0b89d6670945f6f27c3b8d316118b.tar.bz2 samba-35f12fd94db0b89d6670945f6f27c3b8d316118b.zip |
r9548: more additions to make test; better checks for starting and stopping smbd
(This used to be commit dbaaf81cec59aae01e71bbb639e1937ebee2454d)
Diffstat (limited to 'source3/script/tests/functions')
-rw-r--r-- | source3/script/tests/functions | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source3/script/tests/functions b/source3/script/tests/functions index 0969c98724..4cc8d4a2c0 100644 --- a/source3/script/tests/functions +++ b/source3/script/tests/functions @@ -2,3 +2,41 @@ ## 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 +} + |