• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ftp in crontab is not working

 
manoj r patil
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 -
--------------
ftp $IP_ADDRESS <<INPUT_END>
passive
cd $TARGET_PARENT_PATH/$CUSTOMER_ACCOUNT/
put $PARENT_PATH/$CUSTOMER_ACCOUNT/$l_filename $l_filename
quit
INPUT_END
--------------

Thanks in advance
 
Craig Taylor
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic