wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes ftp in crontab is not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "ftp in crontab is not working" Watch "ftp in crontab is not working" New topic

ftp in crontab is not working

manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
I have written one shell script for uploading some files using ftp. I configured .netrc to use non-interactive mode for logging in to ftp.

When I run the script manuall, everything works fine. But when I add this file in crontab, the job gets executed but it does not do ftp.

Below is the snippet of the script for quick reference -
put $PARENT_PATH/$CUSTOMER_ACCOUNT/$l_filename $l_filename

Thanks in advance

love your job and not your company;
...because you never know when your company will stop loving you!
Craig Taylor
Ranch Hand

Joined: Jul 17, 2008
Posts: 64
Remember that when the cron commands are run that the script environment is fairly sparse. Environment variables such as $PATH are typically missing or non-existant.

Try ensuring the you use : '/bin/ftp' or whereever ftp is located on your system.

Hope that helps,
manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
Craig, you were right! Actually I have used absolute path everywhere else but for ftp thinking that it will be in the standard places of linux.

To my surprise, I found ftp at /usr/kerberos/bin and after adding this before ftp, it worked!

Thanks a lot!
I agree. Here's the link: http://aspose.com/file-tools
subject: ftp in crontab is not working
Similar Threads
How to save crontab configuration when using SSH?
cronss job
How to catch ftp errors in shell script
Write CRON Job
help with a shell script