Trying to schedule ftp login using cron
I have a fairly limited knowledge of linux and am having an unusual problem. I am trying to use cron to schedule automatic updates of my dat files by logging into McAfee's ftp server and downloading them. I am trying to do this by using a script that I got from the McAfee site. The script contains two parts. One is the .netrc file which contains login details and which I place in the root home directory. The other is a script called update.sh which contains the commands for logging into the ftp server, checking for new dats and updating them if available.
What is unusual about my problem is that, if I am logged in as root, I can manually run the update.sh script and it works fine. However, when I schedule the script to run by placing it in /etc/cron.daily it does not work. The following are parts of the messages which are mailed to root on a daily basis:
Name (ftp.nai.com:root): /etc/cron.daily/update.sh: line 31: [: *.ta: integer expression expected
tar: dat-*tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
I think the important part of the message is the "login failed" bit. The rest is simply due to the fact that the script cannot get to the dat files (due to the failed login obviously).
Because the script works when I run it manually I think it might have something to do with the fact that the .netrc file is inacessable when run using cron. I find this odd though as cron runs as root.
Does anybody have any ideas?
Thanks in advance