Cat >forallhost.sh
#!/bin/bash
For i in {1..9}
Do
/usr/bin/expect autoyes.sh $i
Done
Cat >autoyesmkdir.sh
#!/usr/bin/expect
Set time 1
Set I [lindex $argv 0]
Spawn ssh 192.168.4. $i "Mkdir/root/.ssh"
Expect {
"Password:" {send "123456\n"}
"#" {Send "hostname\n"}
}
Cat >autoyesuprsa.sh
#!/usr/bin/expect
Set time 1
Set I [lindex $argv 0]
Spawn Scp-r/root/.ssh 192.168.4. $i:/root/.ssh
Expect {
"Password:" {send "123456\n"}
"#" {Send "hostname\n"}
}
################################################################# #3
Cat uprsa.sh
#!/bin/bash-r/root/.ssh/ 192.168.4. $i:/root/.ssh/.
For i in {1..9}
Do
Scp-r/root/.ssh/ 192.168.4. $i:/root/.ssh/.
Done
Cat startvm.sh
#!/bin/bashsh Start rh7_node$i
For i in {1..9}
Do
Virsh Start rh7_node$i
Done
Cat Note
Local IP--76.121.210.172
172.25.254.250
Server-->172.25.0.11
Cat forallhost.sh
#!/bin/bash
For i in {1..9}
Do
Expect autoues.sh $i
Done
Cat autoyes.sh
#!/usr/bin/expect
Set time 1
Set I [lindex $argv 0]
Spawn ssh 192.168.4. $i "Mkdir/root/.ssh"
Expect {
"Password:" {send "123456\n"}
"#" {Send "hostname\n"}
}
Cat autoyesuprsa.sh
#!/usr/bin/expect
Set time 1
Set I [lindex $argv 0]
Spawn Scp-r/root/.ssh 192.168.4. $i:/root/.ssh
Expect {
"Password:" {send "123456\n"}
"#" {Send "hostname\n"}
}
Automatic mutual trust Script Shell/expect