• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ftp in crontab is not working

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
reply
    Bookmark Topic Watch Topic
  • New Topic