1 #! /usr/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
8 #
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
13 #
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 #
20 # CDDL HEADER END
21 #
22
23 #
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27
28 NAME=$(basename $0)
29
30 . $STF_SUITE/include/sharemnt.kshlib
31
32 # Turn on debug info, if requested
33 export STC_GENUTILS_DEBUG=$STC_GENUTILS_DEBUG:$SHAREMNT_DEBUG
34 [[ :$SHAREMNT_DEBUG: == *:${NAME}:* \
35 || :${SHAREMNT_DEBUG}: == *:all:* ]] && set -x
36
37 function cleanup { # cleanup and exit
38 rm -f $STF_TMPDIR/*.out.$$
39 exit ${1}
40 }
41
42 # Now cleanup the server..
43 SRVDEBUG=$SHAREMNT_DEBUG
44 [[ :$SHAREMNT_DEBUG: == *:RSH:* ]] && SRVDEBUG=all
45 RSH root $SERVER \
46 "export SHAREMNT_DEBUG=$SRVDEBUG; \
47 F=$SRV_TMPDIR/sharemnt.nfslogd; \
48 if [[ -f \$F ]]; then \$F -c; else echo NeedlessToDo; fi" \
49 > $STF_TMPDIR/rsh.out.$$ 2>&1
50 rc=$?
51 print_debug $STF_TMPDIR/rsh.out.$$
52
53 egrep "^NeedlessToDo$" $STF_TMPDIR/rsh.out.$$ > /dev/null 2>&1
54 if (( $? == 0 && $rc == 0 )); then
55 echo "$NAME: script<$SRV_TMPDIR/sharemnt.nfslogd> does not exist"
56 echo "\t it seems we don't need to cleanup on SERVER<$SERVER>"
57 cleanup $STF_PASS
58 fi
59
60 grep "Done" $STF_TMPDIR/rsh.out.$$ > /dev/null 2>&1
61 if (( $? != 0 || $rc != 0 )); then
62 echo "$NAME: run cleanup script on SERVER<$SERVER> failed :"
63 cat $STF_TMPDIR/rsh.out.$$
64 echo "\t please cleanup the SERVER manually"
65 cleanup $STF_FAIL
66 fi
67
68 cleanup $STF_PASS