-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvplexui.sh
69 lines (61 loc) · 1.61 KB
/
vplexui.sh
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
#!/bin/bash
# VPLEXUI Version 1.1
# Author: [email protected]
#Variables de argumentos
user=$1
pass=$2
vplexui=$3
function fase1 () {
#Lista de equipos
dispo=$(cat ~/equipos.txt |awk {'print $1'})
mkdir -p /tmp/VPlexLOGs
#Bucle para iterar sobre cada equipo
for line in $dispo ;do
echo Entering $line...
{
/usr/bin/expect << EOF
set timeout 50
spawn ssh $user@$line
expect "Password:"
send "$pass\r"
expect {
"$user" {
send "vplexcli\r"
expect "Name:"
send "$user\r"
expect "Password:"
send "$pass\r"
expect "VPlexcli:"
send "ll clusters/cluster-*/virtual-volumes\r"
expect "VPlexcli:"
send "$exit\r"
expect "$user"
send "$exit\r"
}
"Permission denied, please try again." {
send "exit\r"
}
}
EOF
} &> /tmp/VPlexLOGs/vplex_$line.log
done;
}
function fase2() {
archi=$(ls -lrt /tmp/VPlexLOGs|awk '{print $9}')
ruta="/tmp/VPlexLOGs/"
for line in $archi
do
echo -e "\n" && cat $ruta$line |egrep -i service@|egrep -v spawn && cat $ruta$line |grep -i $vplexui
done
}
if [ -z "$user" ] || [ -z "$pass" ] || [ -z "$vplexui" ]; then
echo ""
echo "Please enter <USER> <PASSWORD> <VirtualVolumeUID>"
echo ""
exit
else
fase1
echo ""
fase2
exit
fi