cron job no function no error
I wrote a scrip to backup my home file which i set it to exec it every five minutes ,
that the crontab is : */5 * * * * job #(i 've tested it before add to crontab ,it works fine ) >>/home/myhome/error.log but as i list the backup file there's nothing ,and found check the error.log ether. i'm not sure what had happened so i seek for the deamon "crond",it's working , the second is the /etc/cron.deny and /etc/cron.allow,both file not exist .So i don't why not my cron job not works ,who knows be help me thanks ! |
cron has a minimal default environment, so you need to specify the complete (absolute) path to any cmds and/or files you use.
Please post your code for further help (in code tags). |
cron has a very skimpy PATH. One common cause of the type of problem that you are experiencing is that Linux can find the program when you execute it from the command line but not find it when you execute it from cron. The solution is to specify the full path name for the program that you are executing in cron. For example use:
/usr/bin/backutil instead of: backutil -------------- Steve Stites |
glad we agree ;)
|
Yes ,i've been considered the relevant path problem ,but all my program used the absolute path.and hereis is my crontab job :
*/5 * * * * sh /home/myhome/backup >>/home/myhome/log/error.log and the below is the script : #!/bin/csh # For backup myfiles #remove the old files cd /home/myhome/backup rm * name=`sh /home/myhome/bin/get-date` #a script for the current data ,fine #now backup the new file tar -cvzf /home/myhome/backup/myfile${name}.tar.gz /home/myhome #end ok ,the the whole code except date-get script . |
Quote:
----------------- Steve Stites |
Actually, I'd simplify by putting the shell in the 1st line and not using sh cmd (in all instances).
Also, supply the complete path for tar, it's NOT a shell built-in. |
All times are GMT -5. The time now is 05:27 PM. |