LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-15-2011, 11:01 AM   #1
grob115
Member
 
Registered: Oct 2005
Posts: 542

Rep: Reputation: 32
cron not running


Hi, cron on one of my boxes isn't running and I failed to determine why. Here are what I have found so far:

[backup@db mysql_backup]$ date
Wed Jun 15 09:04:06 PDT 2011
[backup@db mysql_backup]$ crontab -e
crontab: installing new crontab
[backup@db mysql_backup]$ crontab -l
6 9 * * * /home/backup/scripts/mysql_backup.sh > /home/backup/scripts/mysql_backup.log
[backup@db mysql_backup]$ date
Wed Jun 15 09:04:29 PDT 2011
[backup@db mysql_backup]$ su
Password:
[root@db mysql_backup]# tail -f /var/log/cron
Jun 15 09:04:15 db crontab[16778]: (backup) BEGIN EDIT (backup)
Jun 15 09:04:23 db crontab[16778]: (backup) REPLACE (backup)
Jun 15 09:04:23 db crontab[16778]: (backup) END EDIT (backup)
Jun 15 09:04:27 db crontab[16780]: (backup) LIST (backup)
Jun 15 09:05:01 db crond[2739]: (backup) RELOAD (cron/backup)

Last edited by grob115; 06-15-2011 at 11:09 AM.
 
Old 06-15-2011, 11:05 AM   #2
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
Apparently there is no problem in the crontab entry. The only thing coming in mind is that when you edit the crontab you have to put a time specification which is at least two minutes after the current time: as you can see from the cron.log at 4:29 the cron daemon has reloaded the crontab, but it will not execute the crontab entry until 4:29 on the next day. If you edit the crontab at 4:28 you have to set the job at 4:30 in order to run it (almost) immediately.
 
Old 06-15-2011, 12:23 PM   #3
musammil123
LQ Newbie
 
Registered: May 2011
Posts: 14

Rep: Reputation: Disabled
Hi
Whether cron functionality is not running your server or particular this cron entry is not running.?
If this particular cron is not running kindly check with simple cron entry.

Below urls are cronjobs reference sites.

http://www.thegeekstuff.com/2009/06/...ntab-examples/
http://adminschoice.com/crontab-quick-reference

Thanks
Mohamed
 
Old 06-16-2011, 11:16 AM   #4
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
colucix, thanks. However, from what I can see in the cron log is that at 09:05 the cron has been reloaded. Now if the job is set to run at 09:06, it should run the minute after it reloaded but it doesn't.

Now the most interesting thing is that it did run the day after but not at the scheduled time. I have since scheduled it to run at 04:00 but it ended up running at 01:00 as per the log. I'm totally lost on this one but will monitor it for another day to see.
 
Old 06-16-2011, 05:51 PM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
hi,

as I can see you put your cron for user [backup@db mysql_backup]
try put it as 'root' and see what happens
 
Old 06-17-2011, 09:07 AM   #6
sang_froid
Member
 
Registered: Oct 2006
Posts: 179

Rep: Reputation: 15
What is the permission and ownership of the file mysql_backup.sh ?

Also, to take mysqlbackup, you will need to specify the root password of mysql in that script. Have you specified the root password in that script ?
 
Old 06-17-2011, 11:13 AM   #7
grob115
Member
 
Registered: Oct 2005
Posts: 542

Original Poster
Rep: Reputation: 32
Hello, thanks for replying. The backup actually works and I get a dump daily. It's just that the time when it executes doesn't match the time set in the cron. Think the following explains it all. It's actually a cron for the user "backup".

Code:
[backup@db mysql_backup]$ crontab -l
0 4 * * * /home/backup/scripts/mysql_db_backup.sh > /home/backup/scripts/mysql_db_backup.log
[backup@db mysql_backup]$ su
Password:
[root@db mysql_backup]# tail -n17 /var/log/cron
Jun 16 23:01:01 db crond[22337]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 00:01:01 db crond[22468]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 01:00:01 db crond[22597]: (backup) CMD (/home/backup/scripts/mysql_db_backup.sh > /home/backup/scripts/mysql_db_backup.log)
Jun 17 01:01:01 db crond[22614]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 01:02:01 db crond[22621]: (root) CMD (run-parts /etc/cron.daily)
Jun 17 01:02:03 db anacron[22625]: Updated timestamp for job `cron.daily' to 2011-06-17
Jun 17 02:01:01 db crond[23225]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 03:01:01 db crond[23356]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 04:01:01 db crond[23487]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 05:01:01 db crond[23620]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 06:01:01 db crond[23751]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 07:01:01 db crond[23882]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 08:01:01 db crond[24011]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 09:01:01 db crond[24179]: (root) CMD (run-parts /etc/cron.hourly)
Jun 17 09:03:32 db crontab[24277]: (backup) LIST (backup)
Jun 17 09:05:02 db crontab[24325]: (root) LIST (root)
Jun 17 09:09:37 db crontab[24360]: (backup) LIST (backup)
 
  


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
Vixie-Cron not running /etc/cron.d/ dman777 Linux - Software 1 02-09-2011 07:42 AM
cron - how to give priority to a task running in cron.daily? MeeLee Linux - Newbie 3 11-09-2010 08:41 AM
Cron is not running Geert86 Linux - Server 3 02-01-2010 10:41 PM
Cron not running sometimes yuiy88 Linux - Newbie 6 02-14-2008 02:37 AM
Cron not running Half_Elf Linux - Software 4 01-10-2003 02:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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