Below script can be scheduled to run every 5 mins to fetch files remote to local server.
Crantab -e would allow you to schedule jobs on LINUX servers.
#!/bin/bash
/usr/bin/expect << EOF
spawn sftp USERNAME@host
expect "Connecting to 127.0.0.1..."
expect "password:"
send "Enter Credential\r"
expect "sftp>"
send "cd Test\r"
expect "sftp>"
send "lcd /home/username/App-Files\r"
expect "sftp>"
send "mget * \r"
expect "sftp>"
send "rm * \r"
expect "sftp>"
send "quit \r"
EOF
No comments:
Post a Comment