Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)
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.
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.
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.
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.