add bin/mib conf dual file
This commit is contained in:
38
bin/dual/sendfile
Normal file
38
bin/dual/sendfile
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/expect
|
||||
|
||||
#This script interative with the remote server, and send the file to it
|
||||
|
||||
#This script have 6 parameters
|
||||
#remoteip: the ip of the remote server
|
||||
#username: the name for logining in
|
||||
#userpass: the password for logining in
|
||||
#resdir: the directory to store the files
|
||||
#sendfile: the file to send to the remote server
|
||||
#desdir: the directory to send the files
|
||||
|
||||
set remoteip [lindex $argv 0]
|
||||
set username [lindex $argv 1]
|
||||
set userpass [lindex $argv 2]
|
||||
set resdir [lindex $argv 3]
|
||||
set sendfile [lindex $argv 4]
|
||||
set desdir [lindex $argv 5]
|
||||
set resultfile [lindex $argv 6]
|
||||
set sessionfile [lindex $argv 7]
|
||||
|
||||
set timeout 6
|
||||
|
||||
spawn sftp $username@$remoteip
|
||||
|
||||
|
||||
expect "*(yes/no)?" {send "yes\n"; expect "*assword: "} timeout {exit 1} "*assword: "
|
||||
send "$userpass\n"
|
||||
expect "*sftp>*"
|
||||
send "cd $desdir\n"
|
||||
send "lcd $resdir\n"
|
||||
send "put $sendfile\n"
|
||||
expect "*100%*"
|
||||
send "put $sessionfile\n"
|
||||
expect "*100%*"
|
||||
exec echo 1 > $resultfile
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user