Hi there, i have a script which connecting to cisco router and making ftp download from somewhere. I use it for measure time/speed of ftp connection.

But there is a problem when i run script manually it works properly and gives output. When i put scripts to crontab it gives the following error

"“%Error reading ftp: //xxx.xx.xxx.xx/a.jpg (Connection timed out)”"

The script:

#!/usr/bin/expect

set timeout 100
spawn telnet xxx.xx.x.xx
expect "Username: "
send "aaaa\r"
expect "Password: "
send "bbbb\r"
expect "*#"
send "conf t\r"
expect "*#"
send "ip ftp username ftpuser\r"
expect "*#"
send "ip ftp password ftppass\r"
expect "*#"
send "exit\r"
expect "*#"
send "copy ftp: disk0:\r"
expect "*? "
send "yyy.yy.yy.y\r"
expect "*? "
send "a.jpg\r"
expect "*? "
send "a.jpg\r"
expect "*]"
send "\r"
expect "*]"
send "\r"
expect "*#"
send "exit"
exit

Could anybody help me about that why it gives error when running on crontab.

BR
Leo