|
Other BSD and UNIX/UNIX-like Any other flavour of BSD or UNIX that does not have a section of its own. |
|
Thread Tools | Display Modes |
|
|
||||
Much of the time when a crontab fails to run it's due to a bad $PATH variable. That is, cron has a shorter $PATH than everything else, so I always, if running a script from cron put complete paths in, such as /usr/bin/whatever. (I put this into the script that it's running.)
That's a wild guess though, since this sounds like something that used to work but no longer works. Would you be a bit more specific? For example, are the failed jobs for the same user, a different user? Could it be that the user lacks privilege? I think I'd try to test it with something really simple, like have it run ls and write it to something to make sure that it at least works. (e.g. ls /var > var.txt) |
|
||||
Thanks for the reply scottro.
I don't think the "path" variable can be the cause here, as the script was working last week. I'd rather suspect an update caused the crash. I have tried removing and installing cron back from Yum. This gave no success. The problem is not with the jobs of only one users. It's all jobs that are not working. As if cron ran and checked the crontabs but did not ran them at all. Here is my /etc/crontab: Code:
# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly Code:
50 * * * * root /bin/ls / > /tmp/ls.txt Any ideas?
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
Oops, forgot to mention what happened in my logs:
Code:
Jul 15 16:16:54 webcam01 crond[23242]: (CRON) STARTUP (V5.0) Jul 16 10:39:01 webcam01 crond[23242]: (*system*) RELOAD (/etc/crontab)
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
|||
I'd check /var/log/messages and the root account's mail directory just in case. However, if that fails there's a checklist of sorts here.
|
|
||||
Thanks for the reply dk_netsvil.
There is nothing relevant in /var/log/messages; No mail for root. Thanks for the link, it is well explained and very helpful. However, there is no solution to my problem. crond is running but not executing any tasks!? I rewrote the crontab file to make sure it is not a syntax error of any kind. It looks like this now: Code:
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ 25 * * * * root /bin/ls / > /tmp/ls.txt Code:
Jul 16 13:20:01 webcam01 crond[23242]: (*system*) RELOAD (/etc/crontab) Code:
# ls -lut /etc/crontab -rw-r--r-- 1 root root 352 Jul 16 13:21 /etc/crontab
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
Quote:
# restorecon -R /usr/sbin/crond /etc/cron* I've seen cron lose its security context following updates before.
__________________
Kill your t.v. |
|
||||
Thanks for the reply anomie. I've executed your command but, still no success.
I've also backed up the old crontab, created a whole new file with a simple crontab definition and tried this. Didn't work. Are there any ways to make crond more verbose?
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
This is all I have since it stopped working:
Quote:
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
Thanks for the reply anomie. To answer your questions:
Code:
# history | grep -A 1 restorecon 1042 man restorecon 1043 restorecon -R /usr/sbin/crond /etc/cron* 1044 service crond restart Quote:
Code:
# mail No mail for root
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
If you haven't checked already, be sure /etc/cron.allow and /etc/cron.deny are not unexpectedly populated. These files are explained in the manpages for crontab(1).
From what you've explained, that does not sound like it's the problem, though. If you have any other recollections of system changes between 'working' and 'broken' that might help establish cause and effect, please share.
__________________
Kill your t.v. |
|
||||
I only have a cron.deny file, which is empty.
This problem was firstly reported on another machine which serves as a print server. Then, I had to move a bunch of machines from RHEL 5 to CentOS 5. See thread: http://daemonforums.org/showthread.php?t=1390. The switch didn't help the print server to revive it's cron. However, I suppose this could be the cause of the webcam's server disease. I switched another bunch of boxes to CentOS this week. All the three of them survived the cron restart, so I am unsure this is the exact cause of the problem. I tried to reboot both machines (the print server and the webcam server). Intersting thing, the format of my cron logs changed, as if the application used switched from vixie-cron to anacron!? Code:
Jul 17 11:44:10 webcam01 anacron[3215]: Anacron 2.3 started on 2008-07-17 Jul 17 11:44:10 webcam01 anacron[3215]: Will run job `cron.daily' in 65 min. Jul 17 11:44:10 webcam01 anacron[3215]: Jobs will be executed sequentially Jul 17 12:49:09 webcam01 anacron[3215]: Job `cron.daily' started Jul 17 12:49:43 webcam01 anacron[3215]: Job `cron.daily' terminated Jul 17 12:49:43 webcam01 anacron[3215]: Normal exit (1 jobs run) I am going to investigate on the case with this change, any insights are still very appreciated. Thanks.
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
Quote:
Quote:
Quote:
__________________
Kill your t.v. |
|
||||
Thanks for the reply anomie. Yes, I still have the same problem. I tough anacron was some kind of remplacement for vixie-cron. Now that I am disillusionned, I have to continue my investigaitons on this case.
Thanks!
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
I'll admit I am stumped on this one. If I were in your shoes, what I'd do is:
Earlier in the thread I had said I wasn't aware of a crond option to make him chattier, but that was on a CentOS 4 box. (I just checked a CentOS 5 box a moment ago and discovered it.)
__________________
Kill your t.v. |
|
||||
Quote:
Quote:
Code:
* * * * * root run-parts /etc/cron.hourly Code:
# cat /etc/sysconfig/crond CRONDARGS="-x ext,sch,proc,pars,load,misc,test,bit" Code:
[21827] load_database() [21827] spool dir mtime unch, no load needed. [21827] tick(54,14,20,6,1) user [root:0:0:...] cmd="run-parts /etc/cron.monthly" user [root:0:0:...] cmd="run-parts /etc/cron.weekly" user [root:0:0:...] cmd="run-parts /etc/cron.daily" user [root:0:0:...] cmd="run-parts /etc/cron.hourly" user [root:0:0:...] cmd="python /usr/share/rhn/virtualization/poller.py" [21827] do_command(run-parts /etc/cron.hourly, (*system*,0,0)) Minute-ly job. Recording time 1216666441 [21827] main process returning to work [21827] do_command(python /usr/share/rhn/virtualization/poller.py, (*system*,0,0)) [21827] main process returning to work [21827] Target time=1216652100, sec-to-wait=60 [22024] child_process('run-parts /etc/cron.hourly') [22024] child continues, closing pipes [22024] child reading output from grandchild [22024] got EOF from grandchild [22024] waiting for grandchild #2 to finish [22024] grandchild #22026 finished, status=0000 [22024] waiting for grandchild #1 to finish [22024] no more grandchildren--mail written? [22025] child_process('python /usr/share/rhn/virtualization/poller.py') [22024] child process done, exiting [21827] sigchld...pid #22024 died, stat=0 [21827] sigchld...no dead kids [22025] child continues, closing pipes [22025] child reading output from grandchild [22025] got EOF from grandchild [22025] waiting for grandchild #2 to finish [22025] grandchild #22027 finished, status=0000 [22025] waiting for grandchild #1 to finish [22025] no more grandchildren--mail written? [22025] child process done, exiting [21827] sigchld...pid #22025 died, stat=0 [21827] sigchld...no children Code:
# service syslog status syslogd (pid 2224) is running... klogd (pid 2227) is running...
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
|
||||
I agree that it looks like crond is issuing a command to run scripts in that directory, e.g.
run-parts /etc/cron.daily Check to make sure you don't have a permissions issue in cron.daily? Can you run the command I bolded (above) and see what it's doing? # bash -x /usr/bin/run-parts /etc/cron.daily (Might need to direct the output somewhere for review.)
__________________
Kill your t.v. |
|
||||
OK. Looks like everything is fine when ran manually. Here are the results:
Code:
# run-parts /etc/cron.daily # Code:
# bash -x /usr/bin/run-parts /etc/cron.daily + set +e + '[' 1 -lt 1 ']' + '[' '!' -d /etc/cron.daily ']' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/0anacron ']' + '[' /etc/cron.daily/0anacron '!=' /etc/cron.daily/0anacron ']' + '[' /etc/cron.daily/0anacron '!=' /etc/cron.daily/0anacron ']' + '[' /etc/cron.daily/0anacron '!=' /etc/cron.daily/0anacron ']' + '[' /etc/cron.daily/0anacron '!=' /etc/cron.daily/0anacron ']' + '[' /etc/cron.daily/0anacron '!=' /etc/cron.daily/0anacron ']' + '[' -x /etc/cron.daily/0anacron ']' + /etc/cron.daily/0anacron + awk -v progname=/etc/cron.daily/0anacron 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/0logwatch ']' + '[' /etc/cron.daily/0logwatch '!=' /etc/cron.daily/0logwatch ']' + '[' /etc/cron.daily/0logwatch '!=' /etc/cron.daily/0logwatch ']' + '[' /etc/cron.daily/0logwatch '!=' /etc/cron.daily/0logwatch ']' + '[' /etc/cron.daily/0logwatch '!=' /etc/cron.daily/0logwatch ']' + '[' /etc/cron.daily/0logwatch '!=' /etc/cron.daily/0logwatch ']' + '[' -x /etc/cron.daily/0logwatch ']' + /etc/cron.daily/0logwatch + awk -v progname=/etc/cron.daily/0logwatch 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/cups ']' + '[' /etc/cron.daily/cups '!=' /etc/cron.daily/cups ']' + '[' /etc/cron.daily/cups '!=' /etc/cron.daily/cups ']' + '[' /etc/cron.daily/cups '!=' /etc/cron.daily/cups ']' + '[' /etc/cron.daily/cups '!=' /etc/cron.daily/cups ']' + '[' /etc/cron.daily/cups '!=' /etc/cron.daily/cups ']' + '[' -x /etc/cron.daily/cups ']' + /etc/cron.daily/cups + awk -v progname=/etc/cron.daily/cups 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/logrotate ']' + '[' /etc/cron.daily/logrotate '!=' /etc/cron.daily/logrotate ']' + '[' /etc/cron.daily/logrotate '!=' /etc/cron.daily/logrotate ']' + '[' /etc/cron.daily/logrotate '!=' /etc/cron.daily/logrotate ']' + '[' /etc/cron.daily/logrotate '!=' /etc/cron.daily/logrotate ']' + '[' /etc/cron.daily/logrotate '!=' /etc/cron.daily/logrotate ']' + '[' -x /etc/cron.daily/logrotate ']' + /etc/cron.daily/logrotate + awk -v progname=/etc/cron.daily/logrotate 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/makewhatis.cron ']' + '[' /etc/cron.daily/makewhatis.cron '!=' /etc/cron.daily/makewhatis.cron ']' + '[' /etc/cron.daily/makewhatis.cron '!=' /etc/cron.daily/makewhatis.cron ']' + '[' /etc/cron.daily/makewhatis.cron '!=' /etc/cron.daily/makewhatis.cron ']' + '[' /etc/cron.daily/makewhatis.cron '!=' /etc/cron.daily/makewhatis.cron ']' + '[' /etc/cron.daily/makewhatis.cron '!=' /etc/cron.daily/makewhatis.cron ']' + '[' -x /etc/cron.daily/makewhatis.cron ']' + /etc/cron.daily/makewhatis.cron + awk -v progname=/etc/cron.daily/makewhatis.cron 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/mlocate.cron ']' + '[' /etc/cron.daily/mlocate.cron '!=' /etc/cron.daily/mlocate.cron ']' + '[' /etc/cron.daily/mlocate.cron '!=' /etc/cron.daily/mlocate.cron ']' + '[' /etc/cron.daily/mlocate.cron '!=' /etc/cron.daily/mlocate.cron ']' + '[' /etc/cron.daily/mlocate.cron '!=' /etc/cron.daily/mlocate.cron ']' + '[' /etc/cron.daily/mlocate.cron '!=' /etc/cron.daily/mlocate.cron ']' + '[' -x /etc/cron.daily/mlocate.cron ']' + /etc/cron.daily/mlocate.cron + awk -v progname=/etc/cron.daily/mlocate.cron 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/prelink ']' + '[' /etc/cron.daily/prelink '!=' /etc/cron.daily/prelink ']' + '[' /etc/cron.daily/prelink '!=' /etc/cron.daily/prelink ']' + '[' /etc/cron.daily/prelink '!=' /etc/cron.daily/prelink ']' + '[' /etc/cron.daily/prelink '!=' /etc/cron.daily/prelink ']' + '[' /etc/cron.daily/prelink '!=' /etc/cron.daily/prelink ']' + '[' -x /etc/cron.daily/prelink ']' + /etc/cron.daily/prelink + awk -v progname=/etc/cron.daily/prelink 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/rpm ']' + '[' /etc/cron.daily/rpm '!=' /etc/cron.daily/rpm ']' + '[' /etc/cron.daily/rpm '!=' /etc/cron.daily/rpm ']' + '[' /etc/cron.daily/rpm '!=' /etc/cron.daily/rpm ']' + '[' /etc/cron.daily/rpm '!=' /etc/cron.daily/rpm ']' + '[' /etc/cron.daily/rpm '!=' /etc/cron.daily/rpm ']' + '[' -x /etc/cron.daily/rpm ']' + /etc/cron.daily/rpm + awk -v progname=/etc/cron.daily/rpm 'progname { print progname ":\n" progname=""; } { print; }' + for i in '$1/*[^~,]' + '[' -d /etc/cron.daily/tmpwatch ']' + '[' /etc/cron.daily/tmpwatch '!=' /etc/cron.daily/tmpwatch ']' + '[' /etc/cron.daily/tmpwatch '!=' /etc/cron.daily/tmpwatch ']' + '[' /etc/cron.daily/tmpwatch '!=' /etc/cron.daily/tmpwatch ']' + '[' /etc/cron.daily/tmpwatch '!=' /etc/cron.daily/tmpwatch ']' + '[' /etc/cron.daily/tmpwatch '!=' /etc/cron.daily/tmpwatch ']' + '[' -x /etc/cron.daily/tmpwatch ']' + /etc/cron.daily/tmpwatch + awk -v progname=/etc/cron.daily/tmpwatch 'progname { print progname ":\n" progname=""; } { print; }' + exit 0
__________________
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cron won't execute a perl script | ivanatora | FreeBSD General | 4 | 17th August 2008 07:53 AM |
cron newsyslog message | starbuck | FreeBSD General | 2 | 6th August 2008 07:33 PM |
Please help me automate getmail with cron | cssgalactic | FreeBSD General | 2 | 9th July 2008 10:13 PM |
Cronjob script does not run in cron | godfrank | FreeBSD General | 9 | 30th June 2008 12:41 AM |
Using sendmail in a cron job | erehwon | OpenBSD General | 6 | 15th May 2008 09:03 PM |