-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrac
More file actions
executable file
·55 lines (48 loc) · 1.04 KB
/
drac
File metadata and controls
executable file
·55 lines (48 loc) · 1.04 KB
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
#!/bin/bash
PASS_LIST="calvin root123 changeme"
function Usage
{
echo "Usage : $0"
echo " poweron|poweroff|reset|powerstatus <nodename|ip>"
}
if [ -z "$1" ] || [ -z "$2" ]
then
Usage
exit
fi
command=$1
ip=$2
# Try each of the passwords in the list
for password in $PASS_LIST
do
# export DISPLAY=none:0.0
# export SSH_ASKPASS=/tmp/ssh_askpass.sh
# pipename="/tmp/ssh_pipe.$$.$$"
#
# echo "echo $password" > $SSH_ASKPASS
# chmod 700 ${SSH_ASKPASS}
case $command in
"poweron")
perl ~/bin/ssh-execute.pl $ip root $password "racadm serveraction powerup"
ret=$?
echo
;;
"poweroff")
perl ~/bin/ssh-execute.pl $ip root $password "racadm serveraction powerdown"
ret=$?
echo
;;
"powerreset")
perl ~/bin/ssh-execute.pl $ip root $password "racadm serveraction powerreset"
perl ~/bin/ssh-execute.pl $ip root $password "racadm serveraction hardreset"
ret=$?
echo
;;
"powerstatus")
perl ~/bin/ssh-execute.pl $ip root $password "racadm serveraction powerstatus"
ret=$?
echo
;;
esac
[ $ret -eq 0 ] && break
done