-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_ssh.sh
More file actions
33 lines (33 loc) · 801 Bytes
/
run_ssh.sh
File metadata and controls
33 lines (33 loc) · 801 Bytes
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
user="adwl"
ipdata="$1"
shift 1
deploy_ip="/tmp/ip.dat"
awk '{if ($0 !~/^#/)print $1}' $ipdata > $deploy_ip
argument=$*
echo $argument
function pssh_login()
{
local deploy=$1
local user=$2
local passwd=$3
shift 3
content=$(python bin/pssh -t -1 -l $user -h $deploy -C $passwd -x "-o StrictHostKeyChecking=no" -i "$*")
me=$(echo $content |grep FAILURE |wc -l)
if [[ $me -gt 0 ]]; then
return -1
fi
python bin/pssh -t -1 -l $user -h $deploy -C $passwd -x "-o StrictHostKeyChecking=no" -i "$*"
return 0;
}
user_list="yourself"
password_list="2015pass"
for user in ${user_list[*]}
do
for passwd in ${password_list[*]}
do
pssh_login $deploy_ip $user $passwd $argument
if [[ $? -eq 0 ]]; then
exit
fi
done
done