FTP Script does not work via cron
Hi,
I have a script wich includes FTP commands. If I execute it interactively it works as expected. When I execute via cron it doesn't copy files existing in remote server This is the script FTP portion (I changed only the server and user names) ftp -in << FIMFLG open ftp_server user ftpuser ftppwd verbose cd /OUT bin get teste.txt bye FIMFLG This is the resulting output Verbose mode on. 250 CWD successful. "/OUT" is current directory. 200 Type set to I local: teste.txt remote: teste.txt 500 The server returned invalid response for PASV command. Passive mode refused. 221 Goodbye File teste.txt is not copied What should I do ? Thanks I fixed this with a different approach. Instead of starting it every five minutes via cron, I include a cycle in the script (finished by the existence of a control file) and submit it with nohup |
ftp not working cron
1. Normally the first thing I recommend is to check the difference in PATH between interactive and cron, but that does not appear to be at issue here. Still, it will not hurt to check that. Settings PATH in your script is an easy way to avoid issues.
2. Have you considered sftp? Not only more secure, it is less dependent upon the remote software, as it is generally OpenSSH end to end. :It looks like there are several things you could set and try. 3. Your script does not appear to explicitly set the current folder locally before running ftp. It really should. 4. PASV can be set, and unset. It does not appear to me that the PASV default should be different under cron or in an interactive shell, but that is one thing to consider. 5. Have you tried/considered lftp? Not only can it be used for many protocols, it is VERY scriptable! |
Quote:
Thanks for the lftp hint. I will try it for other situations. |
All times are GMT -5. The time now is 06:26 PM. |