bash scripts
This commit is contained in:
1 parent
7ed4fc67d5
commit
7db38ae9f4
25 files changed
+2375
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/expect -f
|
||||
#Copy Crontab of raspberry and serverhost
|
||||
array set host { 0 "serverhost" 1 "raspberry"}
|
||||
array set user { 0 "root" 1 "lucas"}
|
||||
array set port { 0 "3032" 1 "1160"}
|
||||
|
||||
for {set i 0} {$i < 2} {incr i 1} {
|
||||
for {set j 0} {$j < 2} {incr j 1} {
|
||||
spawn ssh -p $port($i) lucas@$host($i)
|
||||
expect {
|
||||
"No route to host" {
|
||||
puts "spawn ssh -p $port($i) lucas@$host($i) failed."
|
||||
exit 0
|
||||
}
|
||||
"Login Sucsessfull" {
|
||||
if {$user($j)=="root"} {
|
||||
send "sudo crontab -l >> crontab.buf\r"
|
||||
expect "lucas: "
|
||||
send "Gina\&1994\&Nonna\r"
|
||||
} else {
|
||||
send "crontab -l >> crontab.buf\r"
|
||||
}
|
||||
#expect "$ "
|
||||
#send "cat crontab.buf\r"
|
||||
expect "$ "
|
||||
send "scp -P 1160 crontab.buf lucas@workhost:~/Documents/Dokumente/Dokumente/Projekte/Server/crontab.$host($i).$user($j)\r"
|
||||
expect "$ "
|
||||
send "rm crontab.buf\r"
|
||||
puts "crontab.$host($i).$user($j) created."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user