r10656: BIG merge from trunk. Features not copied over
[Samba/nascimento.git] / source3 / script / tests / functions
blob40e185e153f76bbaab89ccc5caa812d0df97c16d
1 ##
2 ## library file for test functions
3 ##
5 ##
6 ## start/stop smbd daemon
7 ##
8 check_smbd_running()
10         ## the smbcontrol ping will return a 0 on success
11         smbcontrol $CONFIGURATION smbd ping 2>&1 > /dev/null
14 start_smbd()
16         echo "Starting smbd...."
18         smbd $CONFIGURATION || return $?
20         sleep 1
22         smbcontrol $CONFIGURATION `cat $PIDDIR/smbd.pid` ping 2>&1 > /dev/null || return $?
25 stop_smbd()
27         smbd_pid=`cat $PIDDIR/smbd.pid`
28         echo "Shutting down smbd (pid $smbd_pid)..."
30         ## belt and braces; first kill and then send a shutdown message
32         kill -TERM $smbd_pid
33         smbcontrol $CONFIGURATION smbd shutdown
35         ## check to see if smbd is already running
36         check_smbd_running
37         if test $? == 0; then
38                 echo "Unable to stop smbd!"
39                 exit 2
40         fi
45 ## start/stop smbd daemon
47 check_nmbd_running()
49         ## the smbcontrol ping will return a 0 on success
50         smbcontrol $CONFIGURATION nmbd ping 2>&1 > /dev/null
53 start_nmbd()
55         echo "Starting nmbd...."
57         nmbd $CONFIGURATION || return $?
59         sleep 1
61         # smbcontrol $CONFIGURATION `cat $PIDDIR/nmbd.pid` ping 2>&1 > /dev/null || return $?
62         kill -0 `cat $PIDDIR/nmbd.pid`
65 stop_nmbd()
67         nmbd_pid=`cat $PIDDIR/nmbd.pid`
68         echo "Shutting down nmbd (pid $nmbd_pid)..."
70         ## belt and braces; first kill and then send a shutdown message
72         kill -TERM $nmbd_pid 2> /dev/null
73         sleep 1
75         ## check to see if smbd is already running
76         kill -0 $nmbd_pid 2> /dev/null
77         if test $? == 0; then
78                 echo "Unable to stop nmbd!"
79                 exit 2
80         fi