bash scripts
This commit is contained in:
1 parent
7ed4fc67d5
commit
7db38ae9f4
25 files changed
+2375
No files matched your search
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/expect -f
|
||||
#Copy Crontab of raspberry and serverhost
|
||||
set host "raspberry"
|
||||
array set user { 0 "root" 1 "lucas"}
|
||||
set port "1160"
|
||||
for {set j 0} {$j < 2} {incr j 1} {
|
||||
spawn ssh -p $port lucas@$host
|
||||
expect {
|
||||
"No route to host" {
|
||||
puts "spawn ssh -p $port SendEnv=TERM lucas@$host 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 3032 crontab.buf lucas@serverhost:~/Documents/Dokumente/Dokumente/Projekte/Server/crontab.$host.$user($j)\r"
|
||||
expect "$ "
|
||||
send "rm crontab.buf\r"
|
||||
puts "crontab.$host.$user($j) created."
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user