LinuxQuestions.org
Visit Jeremy's Blog.
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 12-13-2011, 04:38 PM   #1
qwertyjjj
Senior Member
 
Registered: Jul 2009
Location: UK
Distribution: Cent OS5 with Plesk
Posts: 1,012

Rep: Reputation: 30
crontab once per week and once per month?


I put a crontab line in to run once every Sunday.
Is this correct * * * * 7 command?
Or will that run it every minute of the day on Sundays only?
Should it be 00 00 * * 7 ?

How can I run something once per month?

Last edited by qwertyjjj; 12-13-2011 at 04:42 PM.
 
Old 12-13-2011, 04:52 PM   #2
thesnow
Member
 
Registered: Nov 2010
Location: Minneapolis, MN
Distribution: Ubuntu, Red Hat, Mint
Posts: 170

Rep: Reputation: 56
The first will run every minute on Sundays. Usually we represent Sunday with 0 instead of 7, but I think most (if not all) distributions can handle either 0 or 7. The second entry will run at midnight Sundays.

To run monthly, you can use @monthly (will run at midnight on the first of the month), or you can specify a day of month and time to run on a more specific schedule. References/examples below.

http://www.thegeekstuff.com/2009/06/...ntab-examples/
 
Old 12-13-2011, 04:56 PM   #3
AuroraZero
Member
 
Registered: Oct 2009
Location: Michigan
Distribution: SlackWare 13.37, Android, Slax, Centos 5.9 Final, Centos 6
Posts: 187

Rep: Reputation: 31
nvm posted already above me

Last edited by AuroraZero; 12-13-2011 at 04:58 PM. Reason: duplicate post
 
Old 12-15-2011, 05:54 AM   #4
Satyaveer Arya
Senior Member
 
Registered: May 2010
Location: Palm Island
Distribution: RHEL, CentOS, Debian, Oracle Solaris 10
Posts: 1,415

Rep: Reputation: 305Reputation: 305Reputation: 305Reputation: 305
Hello,

You can use :

00 00 * * 0
This will run at midnight of Sundays.

And for running something once per, let's say 1st day of the month then you can use:

00 00 1 * *

This above entry will run your code 1st day of every month at midnight.
 
1 members found this post helpful.
  


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
LXer: This week at LWN: Null pointers, one month later LXer Syndicated Linux News 0 09-01-2009 11:00 AM
LQ-er of the day/week/month/year? alan_ri LQ Suggestions & Feedback 0 01-24-2009 06:11 PM
Multicount in PHP , displays visits on current day, week, month, year and total visit xbaez Programming 1 04-24-2005 03:50 AM
Top posters of the month/week masand LQ Suggestions & Feedback 20 08-30-2004 01:07 AM


All times are GMT -5. The time now is 10:19 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration