LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Schedule a command for twice daily with cron? (http://www.linuxquestions.org/questions/linux-software-2/schedule-a-command-for-twice-daily-with-cron-454804/)

pdeman2 06-14-2006 05:35 PM

Schedule a command for twice daily with cron?
 
OK, I have a very quick question. I have Logwatch running once a day with cron, how do I set it up to run twice a day?

DrOzz 06-14-2006 05:40 PM

Code:

30      6,15    *      *      *    somecommand.sh
This is just purely an example, but you will see that this is a cron entry that will run at 6:30AM and then 3:30PM (15 is 3 in military time). Just comma seperate the hours, or comma seperate whatever section of the cron.

acid_kewpie 06-14-2006 05:40 PM

just put two values in the second column, e.g. "0 3,15 * * * command" would run at 3am and 3pm

pdeman2 06-14-2006 07:50 PM

OK, I took the 0logwatch script from /etc/cron.daily and I put in a new directory called /etc/cron.twice_daily.
Then I added "0 5,17 * * * root run-parts /etc/cron.twice_daily" in my crontab and restarted cron.

That should work, right? This is the first time I've ever really used cron.

Thanks for the help.

DrOzz 06-14-2006 08:48 PM

yub, so at 5:00AM and 5PM your going to run ;)

pdeman2 06-14-2006 09:03 PM

Excellent :)

Geremia 04-23-2013 06:32 PM

Does "*/12" work?
 
Can't you use "*/12" to mean "every 12 hours"?

acid_kewpie 04-23-2013 06:47 PM

yes, but he wanted 5pm, not midnight and noon.

Note this thread is SEVEN YEARS OLD. The specific question is no longer relevant.


All times are GMT -5. The time now is 12:48 AM.