LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How can I change the default time of cron of the system? (https://www.linuxquestions.org/questions/linux-general-1/how-can-i-change-the-default-time-of-cron-of-the-system-454174/)

wuqso 06-12-2006 08:39 PM

How can I change the default time of cron of the system?
 
Hi there, below is the content of my default 'crontab' file at /etc.


SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
40 4 1 * * root run-parts /etc/cron.monthly


So the default time of running crons (cron.daily, cron.weekly, etc) should be at 4 am. But, of course, my computer is shut down at that time. Then the crons usually run at about 9:20 am (I don't know why). I do not want that because I'm usually busy at that time. So I have changed all the '4' into '12' in the crontab file. Now I have the crons run at 12 am (12:02, 12:22, and 12:40 in fact) but the session at 9:20 am is not eliminated. So I have two sessions of crons every day...

Who can help me to eliminate the cron task at 9:20 am?

slackhack 06-12-2006 09:43 PM

i think in most cases you're supposed to use the crontab -e command to change cron, not edit the crontab file directly. but maybe there are different implementations of cron where you can just edit /etc/crontab, not sure. in any case, it might be helpful if you could post the output of crontab -l. i'm not seeing where the 9:20 is in what you posted.

wuqso 06-12-2006 11:04 PM

Thanks for your answer, slackhack.

In fact, I have edited the crontab file directly. This approach works in at least FC3 but fails in my FC5 now. I do not know what's the reason for this result.

I input 'crontab -l' as root but got 'no crontab for root'. How can I get the output of crontab for the system?

mekump 06-14-2006 06:26 AM

Hello,

You may want to check the man page for anacron.

Mike

wuqso 06-14-2006 07:48 PM

Thank you, Mike. I checked the man page of anacron but did not find any useful information. Could you please put your idea in more detail?

mekump 06-15-2006 07:04 AM

Hello,

I was just thinking that your job running at 0920 might be because of anacron. You may want to check the contents of your /etc/anacrontab. For example, if you power your pc up at 0900 and you have a line in the anacrontab file with a delay of 20 minutes, then the job on that line will run at 0920. You may also see something in the log file /var/log/cron that indicates this. If this is true, you can simply change the delay to suit you. If you need more info on anacrontab, check the man page. Let me know if this helps.

Mike


All times are GMT -5. The time now is 04:42 PM.