Expect script to automate ftp upload
#!/usr/bin/expect
spawn ftp ftp.remotedomain.com
expect "Name (ftp.remotedomain:root):"
send "username\r" //provide the username here
expect "Password:"
send "password\r" //provide the password here
expect "ftp>"
send "lcd /var/log/httpd\r" //any desired location
expect "ftp>"
send "put *.acslog\r" //any file
expect "ftp>"
send "bye\r"
#interact
Hope the script is self explanatory. You need to have "expect" rpm installed on the server and you can run it as
#expect scriptname
or you can put the above command in a file and can make it a bash executable.
With little modifications you can use this script for automating ssh logging also.
If anyone want help on that just post it here I will post taht code also
|