LinuxQuestions.org
Visit Jeremy's Blog.
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 05-08-2013, 11:58 PM   #1
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Rep: Reputation: 0
cron.monthly not running - everything else is


Hi Guys

I am having an issue in Red Hat 6.3 where cron.monthly is not being run - the others all are but cron.monthly is not.

Looking at the logfile I can see that the others all are all being run but there is no entry in the logfile showing cron.monthly. There is an entry for cron.weekly which is empty, but none for cron.monthly.

I am wondering if the @monthly macro in my anacrontab needs to be set somewhere?

Here is a copy of the anacrontab:

Code:
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly
cron logfile for 00:00 to 06:00 on 1st May:

Code:
May  1 00:00:01 spvx10599 CROND[10856]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 00:01:01 spvx10599 CROND[10948]: (root) CMD (run-parts /etc/cron.hourly)
May  1 00:01:01 spvx10599 run-parts(/etc/cron.hourly)[10948]: starting 0anacron
May  1 00:01:01 spvx10599 anacron[10961]: Anacron started on 2013-05-01
May  1 00:01:01 spvx10599 run-parts(/etc/cron.hourly)[10963]: finished 0anacron
May  1 00:01:01 spvx10599 anacron[10961]: Jobs will be executed sequentially
May  1 00:01:01 spvx10599 anacron[10961]: Normal exit (0 jobs run)
May  1 00:01:01 spvx10599 run-parts(/etc/cron.hourly)[10948]: starting mcelog.cron
May  1 00:01:01 spvx10599 run-parts(/etc/cron.hourly)[10971]: finished mcelog.cron
May  1 00:10:02 spvx10599 CROND[11984]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 00:20:01 spvx10599 CROND[13143]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 00:30:01 spvx10599 CROND[14228]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 00:40:01 spvx10599 CROND[15337]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 00:50:01 spvx10599 CROND[16494]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:00:01 spvx10599 CROND[17648]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:01:01 spvx10599 CROND[17784]: (root) CMD (run-parts /etc/cron.hourly)
May  1 01:01:01 spvx10599 run-parts(/etc/cron.hourly)[17784]: starting 0anacron
May  1 01:01:01 spvx10599 anacron[17796]: Anacron started on 2013-05-01
May  1 01:01:01 spvx10599 anacron[17796]: Jobs will be executed sequentially
May  1 01:01:01 spvx10599 anacron[17796]: Normal exit (0 jobs run)
May  1 01:01:01 spvx10599 run-parts(/etc/cron.hourly)[17798]: finished 0anacron
May  1 01:01:01 spvx10599 run-parts(/etc/cron.hourly)[17784]: starting mcelog.cron
May  1 01:01:01 spvx10599 run-parts(/etc/cron.hourly)[17807]: finished mcelog.cron
May  1 01:10:01 spvx10599 CROND[18768]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:20:02 spvx10599 CROND[19835]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:30:01 spvx10599 CROND[20889]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:40:01 spvx10599 CROND[21910]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 01:50:01 spvx10599 CROND[22985]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:00:01 spvx10599 CROND[24028]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:01:01 spvx10599 CROND[24122]: (root) CMD (run-parts /etc/cron.hourly)
May  1 02:01:01 spvx10599 run-parts(/etc/cron.hourly)[24122]: starting 0anacron
May  1 02:01:02 spvx10599 anacron[24134]: Anacron started on 2013-05-01
May  1 02:01:02 spvx10599 anacron[24134]: Jobs will be executed sequentially
May  1 02:01:02 spvx10599 anacron[24134]: Normal exit (0 jobs run)
May  1 02:01:02 spvx10599 run-parts(/etc/cron.hourly)[24136]: finished 0anacron
May  1 02:01:02 spvx10599 run-parts(/etc/cron.hourly)[24122]: starting mcelog.cron
May  1 02:01:02 spvx10599 run-parts(/etc/cron.hourly)[24144]: finished mcelog.cron
May  1 02:10:01 spvx10599 CROND[25108]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:20:01 spvx10599 CROND[26182]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:30:01 spvx10599 CROND[27241]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:40:01 spvx10599 CROND[28264]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 02:50:01 spvx10599 CROND[29391]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:00:01 spvx10599 CROND[30450]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:01:01 spvx10599 CROND[30591]: (root) CMD (run-parts /etc/cron.hourly)
May  1 03:01:01 spvx10599 run-parts(/etc/cron.hourly)[30591]: starting 0anacron
May  1 03:01:01 spvx10599 anacron[30616]: Anacron started on 2013-05-01
May  1 03:01:01 spvx10599 anacron[30616]: Will run job `cron.daily' in 21 min.
May  1 03:01:01 spvx10599 anacron[30616]: Will run job `cron.weekly' in 41 min.
May  1 03:01:01 spvx10599 anacron[30616]: Jobs will be executed sequentially
May  1 03:01:01 spvx10599 run-parts(/etc/cron.hourly)[30618]: finished 0anacron
May  1 03:01:01 spvx10599 run-parts(/etc/cron.hourly)[30591]: starting mcelog.cron
May  1 03:01:01 spvx10599 run-parts(/etc/cron.hourly)[30633]: finished mcelog.cron
May  1 03:10:01 spvx10599 CROND[31577]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:20:01 spvx10599 CROND[32715]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:22:01 spvx10599 anacron[30616]: Job `cron.daily' started
May  1 03:22:01 spvx10599 run-parts(/etc/cron.daily)[389]: starting 00webalizer
May  1 03:22:02 spvx10599 run-parts(/etc/cron.daily)[406]: finished 00webalizer
May  1 03:22:02 spvx10599 run-parts(/etc/cron.daily)[389]: starting 0logwatch
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[771]: finished 0logwatch
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[389]: starting certwatch
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[782]: finished certwatch
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[389]: starting cups
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[789]: finished cups
May  1 03:22:09 spvx10599 run-parts(/etc/cron.daily)[389]: starting logrotate
May  1 03:22:10 spvx10599 run-parts(/etc/cron.daily)[796]: finished logrotate
May  1 03:22:10 spvx10599 run-parts(/etc/cron.daily)[389]: starting makewhatis.cron
May  1 03:22:11 spvx10599 run-parts(/etc/cron.daily)[926]: finished makewhatis.cron
May  1 03:22:11 spvx10599 run-parts(/etc/cron.daily)[389]: starting mlocate.cron
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[957]: finished mlocate.cron
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[389]: starting prelink
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[969]: finished prelink
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[389]: starting readahead.cron
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[981]: finished readahead.cron
May  1 03:22:22 spvx10599 run-parts(/etc/cron.daily)[389]: starting rhsmd
May  1 03:22:24 spvx10599 run-parts(/etc/cron.daily)[1014]: finished rhsmd
May  1 03:22:24 spvx10599 run-parts(/etc/cron.daily)[389]: starting tapsprodlx64_audit_file_cleanup
May  1 03:22:24 spvx10599 run-parts(/etc/cron.daily)[1111]: finished tapsprodlx64_audit_file_cleanup
May  1 03:22:24 spvx10599 run-parts(/etc/cron.daily)[389]: starting timeresync
May  1 03:22:35 spvx10599 run-parts(/etc/cron.daily)[1121]: finished timeresync
May  1 03:22:35 spvx10599 run-parts(/etc/cron.daily)[389]: starting tmpwatch
May  1 03:22:35 spvx10599 run-parts(/etc/cron.daily)[1160]: finished tmpwatch
May  1 03:22:35 spvx10599 anacron[30616]: Job `cron.daily' terminated
May  1 03:30:01 spvx10599 CROND[2138]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:40:01 spvx10599 CROND[3507]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 03:42:11 spvx10599 anacron[30616]: Job `cron.weekly' started
May  1 03:42:11 spvx10599 anacron[30616]: Job `cron.weekly' terminated
May  1 03:42:11 spvx10599 anacron[30616]: Normal exit (2 jobs run)
May  1 03:50:01 spvx10599 CROND[4746]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:00:01 spvx10599 CROND[5862]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:01:01 spvx10599 CROND[5964]: (root) CMD (run-parts /etc/cron.hourly)
May  1 04:01:01 spvx10599 run-parts(/etc/cron.hourly)[5964]: starting 0anacron
May  1 04:01:01 spvx10599 run-parts(/etc/cron.hourly)[5973]: finished 0anacron
May  1 04:01:01 spvx10599 run-parts(/etc/cron.hourly)[5964]: starting mcelog.cron
May  1 04:01:01 spvx10599 run-parts(/etc/cron.hourly)[5984]: finished mcelog.cron
May  1 04:10:02 spvx10599 CROND[6954]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:10:02 spvx10599 CROND[6953]: (root) CMD (/usr/share/spamassassin/sa-update.cron 2>&1 | tee -a /var/log/sa-update.log)
May  1 04:20:01 spvx10599 CROND[8042]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:30:01 spvx10599 CROND[9083]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:40:01 spvx10599 CROND[10104]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 04:50:02 spvx10599 CROND[11192]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:00:01 spvx10599 CROND[12253]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:01:01 spvx10599 CROND[12344]: (root) CMD (run-parts /etc/cron.hourly)
May  1 05:01:01 spvx10599 run-parts(/etc/cron.hourly)[12344]: starting 0anacron
May  1 05:01:01 spvx10599 run-parts(/etc/cron.hourly)[12353]: finished 0anacron
May  1 05:01:01 spvx10599 run-parts(/etc/cron.hourly)[12344]: starting mcelog.cron
May  1 05:01:01 spvx10599 run-parts(/etc/cron.hourly)[12361]: finished mcelog.cron
May  1 05:10:01 spvx10599 CROND[13296]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:20:01 spvx10599 CROND[14396]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:30:02 spvx10599 CROND[15425]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:40:01 spvx10599 CROND[16437]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 05:50:01 spvx10599 CROND[17526]: (root) CMD (/usr/lib64/sa/sa1 1 1)
May  1 06:00:01 spvx10599 CROND[18675]: (root) CMD (/usr/lib64/sa/sa1 1 1)

Does anyone have an idea as to what is causing this problem?
 
Old 05-09-2013, 02:17 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by Stannley View Post
I am wondering if the @monthly macro in my anacrontab needs to be set somewhere?
No and the entry looks OK to me.


Quote:
Originally Posted by Stannley View Post
Does anyone have an idea as to what is causing this problem?
Are there actually any cron jobs in /etc/cron.monthly/?
Cron emails errors so did you check (the email account of the unprivileged user who should receive) root email?
 
Old 05-09-2013, 02:25 AM   #3
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Original Poster
Rep: Reputation: 0
Thanks for your response.
Quote:
Originally Posted by unSpawn View Post
Are there actually any cron jobs in /etc/cron.monthly/?
Yes, there are two jobs, one of them has a file extension, the other not, however cron.weekly is empty and that still appears in the logfile so I would at least expect to see the monthly one in there too.
Quote:
Originally Posted by unSpawn View Post
Cron emails errors so did you check (the email account of the unprivileged user who should receive) root email?
I usually keep errors of this nature but can't find any from 1st May so I have to believe that I didn't receive any. I have received other cron errors in the past (although I am not sure if I have from this server), and I do receive the logwatch emails so I don't think there are any errors in the email setup.
 
Old 05-09-2013, 03:12 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Can you check from previous logs if cron.monthly ever ran before and if it's logged elsewhere like /var/log/audit/audit.log? And ownership / perms on /etc/cron.monthly and its contents?
 
1 members found this post helpful.
Old 05-09-2013, 11:52 PM   #5
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Can you check from previous logs if cron.monthly ever ran before and if it's logged elsewhere like /var/log/audit/audit.log? And ownership / perms on /etc/cron.monthly and its contents?
Ok, this is odd. I grepped the cron logs and found that cron.monthly ran successfully today (10th) and also on April 10th, but it has never run before that (this machine has been up and running continuously since before Christmas, except for a restart on 1st April).

So, it appears that its running on every 10th of the month, which seems a little strange! Is there a way I can reset it to run on the 1st of every month?

Last edited by Stannley; 05-10-2013 at 02:26 AM.
 
Old 05-10-2013, 03:45 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Suggest you ditch Anacron for good 'ol crond. At least that's what I tend to do...
 
1 members found this post helpful.
Old 05-12-2013, 07:30 PM   #7
Stannley
Member
 
Registered: Jul 2010
Posts: 35

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Suggest you ditch Anacron for good 'ol crond. At least that's what I tend to do...
Yeah, perhaps I should. Thanks mate!
 
Old 10-01-2016, 10:20 AM   #8
rossboulet
LQ Newbie
 
Registered: Sep 2016
Posts: 1

Rep: Reputation: Disabled
cron.monthly date

Sorry to bump an old thread, but I had a similar question and found an answer. Anacron keeps track of the last time cron.daily/weekly/monthly were run. There are small files with just the last date in /var/spool/anacron. So, assuming your system is up 24/7, edit /var/spool/anacon/cron.monthly to hold the date of the previous first of the month. So if it is the middle of October, 2016, set the file to read 20161001. Then when the 1st of November rolls around, the @monthly will kick in and run it on 11-1 and update the file accordingly.
 
  


Reply

Tags
cron, red hat



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
cron.monthly how do they run? charu Linux - Newbie 1 12-08-2010 04:55 PM
cron - how to give priority to a task running in cron.daily? MeeLee Linux - Newbie 3 11-09-2010 08:41 AM
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 08:57 PM
scheduling monthly job in cron from debian sarge 3.1 sridhar11 Debian 2 10-28-2005 09:03 AM
Monthly Archiving Script... help with "date" & "cron" Supp0rtLinux Linux - Software 3 01-03-2003 09:29 PM

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

All times are GMT -5. The time now is 01:18 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