LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-03-2008, 10:32 AM   #1
kckabobus
LQ Newbie
 
Registered: Apr 2008
Posts: 2

Rep: Reputation: 0
Question How to set up a Cron Job to run every other week or every three months etc.


I've looked through plenty of cron job tutorials and I've gotten a great feel for how to run a cron job at 4 pm every day or on the 10th of every month but I haven't found anyone that will tell me how to run something every other week or every 3rd hour. I found this in a tutorial

*/5 * * * * ~/bashpodder/bashpodder.sh

which says that it runs every five minutes. Does this mean I can use the '/' operator to specify every other month like */2. I also saw something that said you can write sun, mon etc.

I guess what I'm really looking for is a complete explanation of what the parser is looking for and what is allowed in each of the first 5 arguments.
 
Old 04-03-2008, 11:19 AM   #2
Cichlid
Member
 
Registered: Jan 2002
Location: Montreal
Distribution: Ubuntu 8.10
Posts: 178

Rep: Reputation: 30
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5

The above link is to a cron man page.

"Step values can be used in conjunction with ranges. Following a range
with ``/<number>'' specifies skips of the number's value through the
range. For example, ``0-23/2'' can be used in the hours field to spec-
ify command execution every other hour (the alternative in the V7 stan-
dard is ``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are also permitted
after an asterisk, so if you want to say ``every two hours'', just use
``*/2''."

With the above quote from the site, it will give you a better idea of how to proceed.

Good luck.
 
Old 04-03-2008, 11:31 AM   #3
kckabobus
LQ Newbie
 
Registered: Apr 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Smile Thanks that explained it very well

Quote:
Originally Posted by Cichlid View Post
http://unixhelp.ed.ac.uk/CGI/man-cgi?crontab+5

The above link is to a cron man page.

"Step values can be used in conjunction with ranges. Following a range
with ``/<number>'' specifies skips of the number's value through the
range. For example, ``0-23/2'' can be used in the hours field to spec-
ify command execution every other hour (the alternative in the V7 stan-
dard is ``0,2,4,6,8,10,12,14,16,18,20,22''). Steps are also permitted
after an asterisk, so if you want to say ``every two hours'', just use
``*/2''."

With the above quote from the site, it will give you a better idea of how to proceed.

Good luck.
Thanks that was very helpful. Like other linux noobs I haven't quite learned to decode the man pages effectively all the time and rely more on forums. I've now got it working and understand completely my options.
 
Old 04-03-2008, 01:36 PM   #4
prad77
Member
 
Registered: Mar 2008
Posts: 101

Rep: Reputation: 15
http://www.adminschoice.com/docs/crontab.htm
http://www.afp548.com/article.php?st...50103223643995

Some cron guides for good understanding.

Gentoo

Last edited by prad77; 04-17-2008 at 03:39 AM.
 
  


Reply

Tags
bash, cron, crontab



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
Can't get a cron job to run derzok Linux - General 10 12-16-2007 04:00 AM
How do I set my profile in CRON job? lolson33 Linux - General 2 12-06-2005 04:18 PM
how to run this cron job ashley75 Linux - General 5 05-24-2004 11:20 AM
Cron job does not run brentos Linux - General 6 12-12-2003 02:37 PM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 12:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration