[CentOS] weird cron problem

Fri Nov 16 13:26:27 UTC 2007
Robert <kerplop at sbcglobal.net>


Andreas Kuntzagk wrote:
>> PATHS - everytime i have cron issues its a PATH problem. The cron env is 
>> not the same as the user when logged in
>>     
>
> Thanks, that's probably the cause. rsnapshot resides in /usr/local/bin
> I changed the PATH in /etc/crontab now. Silly that I didn't see it.
> So jobs in /etc/crontab are executed with the PATH in there, but jobs in
> roots crontab are executed with the PATH set in .bashrc?
>
> Andreas
>   
You can prove to yourself quite easily that $PATH gets manipulated.  
Simply make a crontab entry like this in root's crontab:

* * * * * echo $PATH >> /root/cronpath

and compare the entries in the resulting file with the command line 
output of
# echo $PATH

(Don't forget to remove that crontab entry when finished playing.)