Dear All ,
I have .sh script wich has the following inside
getFileName=Listportfolio.txt.`date +'%Y%m%d`
ftp -n 172.10.10.1<<EOF
user xxx xxx
bin
cd /home/gbs/FTP_Script
get /home/gbs/FTP_Script/$getFileName
bye
EOF
EOF
when I run the scripts I can get the File from the host directory without any problem but when I the script run from the crontab I got the following
/home/gbs/FTP_Script/Listportfolio.txt.20081125: No such file or directory
Listportfolio.txt.20081125 not found
note that I used the absolute value since the stupid cron does under stand the relative path
I Put at the top of the scrip the following
export FTPATH=/home/gbs/FTP_Script
but does not work
maybe should I set this enviourmet on the remote machine even it's not mine
and if I have to do this can I execute this statment in the FTP consol
export FTPATH=/home/gbs/FTP_Script
crontab uses a different shell - from what you think you are are using in your script. Whatever shell you use must be in the shebang at the top of your script. Which is probably why your export does not work. Straight Bourne shell does not support the syntax you used.
crontab DOES NOT execute any profile scripts. You have to source any profile script you must have to make things work.
In short - if you test a cron script in your user envrionment, you have to duplicate it in every way to make sure the crontab entry behaves. This is a huge cause of cron script problems.