Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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.
I don't have any crontab line as such. I just put the script into the appropriate cron directory (in this case /etc/cron.daily). To do this I log in as a normal user and su to root. Is this ok or do I need to log in directly as root?
Here is a copy of the system crontab file (located in /etc/crontab). I don't suppose there's anything interesting in it though as its pretty much your standard crontab file!