Well, once again I was presented with a nice AutoSupport warning once I logged into my NOW account. Since we don’t have CIFS and/or NFS licensed on our filers, I wrote a cute little script that does the whole work for me.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
| #!/bin/bash
TMPDIR="$( mktemp -d )"
KEY_FILE="/root/.ssh/netapp.dsa"
SSH_OPTS="/root/.ssh/netapp-ssh_config"
FAS_CTRL=$1
QUALDEVICES=$2
ssh_fas() {
# $@: commands for Data ONTAP
COMMANDS="$@"
/usr/bin/ssh -i $KEY_FILE -l root -F $SSH_OPTS $COMMANDS
}
#set -x
echo "Updating qual_devices on $FAS_CTRL"
# Enable ftpd if it isn't enabled already
echo -n "Checking FTP subsystem"
FTPD_INITIAL_STATE="$( ssh_fas $FAS_CTRL options ftpd.enable |
awk '{ print $2 }' )"
if [ $FTPD_INITIAL_STATE == "off" ] ; then
ssh_fas $FAS_CTRL options ftpd.enable on
echo " .... ok"
else
echo " .... ok"
fi
echo
read -s -p "Please supply the root password for $FAS_CTRL: "
ROOT_PASSWD=$REPLY
echo
echo "Checking qual_devices:"
echo -n " Running: "
mkdir $TMPDIR/fas-version
# Check the old version.
ftp -n $FAS_CTRL >/dev/null <<END_SCRIPT
prompt
user root $ROOT_PASSWD
lcd $TMPDIR/fas-version
cd /etc
mget qual_devices*
quit
END_SCRIPT
FAS_VERSION="$( grep Datecode $TMPDIR/fas-version/qual_devices_v3 |
head -n1 | cut -d -f3 )"
echo "$FAS_VERSION"
# Unzip the qual_devices.zip file and compare it.
ORIGPWD=$PWD
mkdir $TMPDIR/new-version
cd $TMPDIR/new-version
unzip $QUALDEVICES >/dev/null
echo -n " New: "
NEW_VERSION="$( grep Datecode $TMPDIR/new-version/qual_devices_v3 |
head -n1 | cut -d -f3 )"
echo "$NEW_VERSION"
echo
# Upload the supplied version if the new file doesn't match the one running
# on the controller
if [ $NEW_VERSION != $FAS_VERSION ] ; then
echo "Uploading qual_devices to $FAS_CTRL"
ftp -n $FAS_CTRL >/dev/null <<END_SCRIPT
prompt
user root $ROOT_PASSWD
lcd $TMPDIR/new-version
cd /etc
mput qual_devices*
quit
END_SCRIPT
# Send an asup message, that the issue is corrected
echo "Generating AutoSupport message"
ssh_fas $FAS_CTRL options autosupport.doit qual_devices_fixed_$NEW_VERSION
fi
#set +x
# Enable ftpd
if [ $FTPD_INITIAL_STATE == "off" ] ; then
ssh_fas $FAS_CTRL options ftpd.enable off
fi
rm -r $TMPDIR
|
The whole thing is surly based, that FTP is configured ( as I described previously).