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 10-18-2010, 03:19 AM   #1
apapa
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Rep: Reputation: 0
Problem with crontab


Hello everyone,

Could you please help me with the following?
I have a cron running the third week of each month and more specific the third Tuesday.

00 21 15-21 * 2 /home/path/script.sh

Suddenly, this month it run on Sunday night! Does anyone knows why that happened?

Thank you in advance!
 
Old 10-18-2010, 04:01 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,356

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, 2 is definitely Tuesday, so if it ran on a Sunday, you've got another copy somewhere...
 
Old 10-18-2010, 04:13 AM   #3
bulls_i3
LQ Newbie
 
Registered: Jan 2010
Posts: 20

Rep: Reputation: 2
I think the way you have it, your script will run on days 15,16,17,18,19,20,21 AND every Tuesday. How many months have you had your script running for?
 
Old 10-18-2010, 04:14 AM   #4
apapa
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you for your response!

I cannot understand... I may have another copy of cron? I cannot see anything with crontab -l command.
 
Old 10-18-2010, 04:20 AM   #5
apapa
LQ Newbie
 
Registered: Oct 2010
Posts: 3

Original Poster
Rep: Reputation: 0
This script is running correctly for four months... until now of course!

It is running once every month, between 15-21 when the day is Tuerday.

Thank you again!
 
Old 10-18-2010, 04:34 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by apapa View Post
This script is running correctly for four months... until now of course!

It is running once every month, between 15-21 when the day is Tuerday.

Thank you again!
Nope. As bulls_i3 already noticed, the job should have been executed every day between 15th and 21th plus every Tuesday. As explained in the crontab man page:
Quote:
Note: The day of a command's execution can be specified by two fields —
day of month, and day of week. If both fields are restricted (ie, aren't *),
the command will be run when either field matches the current time. For example,
"30 4 1,15 * 5" would cause a command to be run at 4:30 am on the 1st and 15th
of each month, plus every Friday.
Which version of cron have you on your system, anyway?
 
  


Reply



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
Crontab problem razzera Debian 4 04-07-2010 08:39 AM
crontab problem almon Linux - Newbie 1 10-11-2007 02:27 PM
crontab problem sunnyanthony Linux - Software 1 01-07-2006 04:48 AM
problem with crontab juanb Linux - Newbie 2 12-16-2003 04:54 AM
crontab problem TomTheNewbie Slackware 1 07-09-2003 07:12 AM

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

All times are GMT -5. The time now is 11:32 AM.

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