PDA

View Full Version : [ubuntu] How to run a Cron every 3 hour?



lopes_andre
December 6th, 2008, 02:52 PM
Hi,

I'm new to cron. I need to run a command every 3 hour. How I do that with Cron?

Something like this in the contrab -e file?



* */03 * * * comand


?

Best Regards, André.

vishzilla
December 6th, 2008, 02:57 PM
thats correct

lopes_andre
December 6th, 2008, 02:58 PM
Thks for you reply.

Best Regards

hrod beraht
December 6th, 2008, 03:56 PM
* */03 * * * comand

The first asterisk is for minutes and the * indicates any/all, i.e. run every minute. So if you only wanted it to run every three hours, set the minute at 0, or top of the hour.


0 */03 * * * comand

Bob

lopes_andre
December 6th, 2008, 04:16 PM
Hi,

The crontab is not doing what I want... I explain:

I have edit my cron with the command "crontab -e" as root

I added the line:


* */03 * * * command

I think with this the Cron will run every 3 hour, but what I see in the /var/log/syslog is that after some time the command have started to run every minute.

My question, how the cron runs once every 3 hour?


Best Regards

lopes_andre
December 6th, 2008, 04:19 PM
The first asterisk is for minutes and the * indicates any/all, i.e. run every minute. So if you only wanted it to run every three hours, set the minute at 0, or top of the hour.


0 */03 * * * comand

Bob

I have not see your reply. Thanks for the solution.

Best Regards.

jmacx81
December 6th, 2008, 04:22 PM
what is cron?

spiderbatdad
December 6th, 2008, 04:32 PM
what is cron?

https://lists.ubuntu.com/mailman/listinfo/Ubuntu-classroom
Your sig indicates you are looking for learning resources.
https://help.ubuntu.com/community/CronHowto

jmacx81
December 6th, 2008, 04:55 PM
https://lists.ubuntu.com/mailman/listinfo/Ubuntu-classroom
Your sig indicates you are looking for learning resources.
https://help.ubuntu.com/community/CronHowto

thanks you very much. I'm actually glad you gave me resources instead of answers.

krishna5481
December 19th, 2008, 03:32 PM
You can also use
* 0,3,6,9,12,15,18,21 * * * /your/command

Try this hard way, you might succeed.

Regards,
Krishna.

Dr Small
December 19th, 2008, 05:00 PM
If you want to run cron every three hours, you use:

00 */3 * * * command

This will ensure that it runs only once every 3 hours, and not every minute of that third hour.