]> git.decadent.org.uk Git - nfs-utils.git/blob - tests/t0001-statd-basic-mon-unmon.sh
pdate addres for Free Software Foundation
[nfs-utils.git] / tests / t0001-statd-basic-mon-unmon.sh
1 #!/bin/bash
2 #
3 # statd_basic_mon_unmon -- test basic mon/unmon functionality with statd
4 #
5 # Copyright (C) 2010  Red Hat, Jeff Layton <jlayton@redhat.com>
6 #
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 0211-1301 USA
20 #
21
22 . ./test-lib.sh
23
24 # This test needs root privileges
25 check_root
26
27 start_statd
28 if [ $? -ne 0 ]; then
29         echo "FAIL: problem starting statd"
30         exit 1
31 fi
32
33 COOKIE=`echo $$ | md5sum | cut -d' ' -f1`
34 MON_NAME=`hostname`
35
36 nsm_client mon $MON_NAME $COOKIE
37 if [ $? -ne 0 ]; then
38         echo "FAIL: mon failed"
39         kill_statd
40         exit 1
41 fi
42
43 statdb_dump | grep $MON_NAME | grep -q $COOKIE
44 if [ $? -ne 0 ]; then
45         echo "FAIL: monitor DB doesn't seem to contain entry"
46         kill_statd
47         exit 1
48 fi
49
50 nsm_client unmon $MON_NAME
51 if [ $? -ne 0 ]; then
52         echo "FAIL: unmon failed"
53         kill_statd
54         exit 1
55 fi
56
57 kill_statd
58