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 backup script that I run on a few machines, but I'm having a problem with one of them. The script is sitting under /etc/cron.daily, but it isn't run when cron.daily is run. When it is run, it should put the date in a log file, but it doesn't, although it did several weeks ago. I've run cron directly, so I know it's not a problem with cron. I can run the script directly.
cron has a different PATH than running from the command line. It is a common problem for a script to work from the command line and not work in cron. You can fix this problem by using the complete path for every command in your script.
Another solution is to set the PATH in the cron script to be exactly the same as the PATH used at the command line.
You should do as Jailbait suggests. One difference could be that on that computer, one of the commands is aliased and that is causing a problem. It is standard practice to always include full pathnames in cron scripts. There is also a security consideration as well.
Another thing to check is that you redirect both stdio and stderr.