summaryrefslogtreecommitdiff
path: root/source3/script/tests/functions
diff options
context:
space:
mode:
Diffstat (limited to 'source3/script/tests/functions')
-rw-r--r--source3/script/tests/functions40
1 files changed, 40 insertions, 0 deletions
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
+}
+