LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-14-2006, 04:35 PM   #1
pdeman2
Member
 
Registered: Jul 2005
Location: Maine, USA
Distribution: OpenSUSE, Gentoo, Fedora, Ubuntu, Mandriva, others
Posts: 413

Rep: Reputation: 30
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?
 
Old 06-14-2006, 04:40 PM   #2
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 58
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.
 
Old 06-14-2006, 04:40 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
just put two values in the second column, e.g. "0 3,15 * * * command" would run at 3am and 3pm
 
Old 06-14-2006, 06:50 PM   #4
pdeman2
Member
 
Registered: Jul 2005
Location: Maine, USA
Distribution: OpenSUSE, Gentoo, Fedora, Ubuntu, Mandriva, others
Posts: 413

Original Poster
Rep: Reputation: 30
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.
 
Old 06-14-2006, 07:48 PM   #5
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 58
yub, so at 5:00AM and 5PM your going to run
 
Old 06-14-2006, 08:03 PM   #6
pdeman2
Member
 
Registered: Jul 2005
Location: Maine, USA
Distribution: OpenSUSE, Gentoo, Fedora, Ubuntu, Mandriva, others
Posts: 413

Original Poster
Rep: Reputation: 30
Excellent
 
Old 04-23-2013, 05:32 PM   #7
Geremia
Member
 
Registered: Apr 2011
Distribution: Slackware 14.1
Posts: 194

Rep: Reputation: 5
Does "*/12" work?

Can't you use "*/12" to mean "every 12 hours"?
 
Old 04-23-2013, 05:47 PM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
yes, but he wanted 5pm, not midnight and noon.

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I schedule a cron job? BillyGalbreath Debian 1 05-18-2006 09:52 PM
Trying to schedule ftp login using cron compuser Linux - General 2 06-10-2005 04:22 AM
cron.daily MrJoshua Linux - General 2 03-19-2003 12:09 PM
how do i schedule events to run daily. ThaddNZ2003 Linux - General 2 03-10-2003 10:59 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM


All times are GMT -5. The time now is 06:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration