Good afternoon
I need a bit of help with an expect script. I have written a script that gets a list of files on an FTP server, it then downloads them. The actual FTP is controlled using an expect script ( shown below )
!/usr/bin/expect -f
set env(TERM) vt100
spawn /usr/bin/sftp -b {path to FTP batch file} username@ftpserver
expect -exact "username@ftpserver's password: "
sleep 20
send -- "\*******\r"
expect eof
The batch file contains a list of files to download.
The batch file looks like this:
cd /{file path}
get file1
get file2
get file3
cd /{path to remote subdirectory}
lcd /{path to local subdirectory}
get file4
The script works as I want when run from the command prompt, but as a cron job it's a different story. When I added this set env(TERM) vt100 it ran as cron job but would only download one file, if there was more than one file it didn't download them.
Any ideas?
Thanks
Alan
I need a bit of help with an expect script. I have written a script that gets a list of files on an FTP server, it then downloads them. The actual FTP is controlled using an expect script ( shown below )
!/usr/bin/expect -f
set env(TERM) vt100
spawn /usr/bin/sftp -b {path to FTP batch file} username@ftpserver
expect -exact "username@ftpserver's password: "
sleep 20
send -- "\*******\r"
expect eof
The batch file contains a list of files to download.
The batch file looks like this:
cd /{file path}
get file1
get file2
get file3
cd /{path to remote subdirectory}
lcd /{path to local subdirectory}
get file4
The script works as I want when run from the command prompt, but as a cron job it's a different story. When I added this set env(TERM) vt100 it ran as cron job but would only download one file, if there was more than one file it didn't download them.
Any ideas?
Thanks
Alan