LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 02-18-2007, 04:55 PM   #1
Jaze
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Rep: Reputation: 0
Cron keeps falling over...


Hi all,

We have cron falling over every day and when it does the load on the web server goes up, until we reboot. There appears to be a cron job that fails (puts crond into D status) but I am unable to map the D status's crond processes in the cron logs.

We're back to reintroducing the cronjobs one at a time until we find out which one is causing it, however this is very frustrating, having done this once already, found the problem and resolved. it is my understanding that if crond runs into a problem with a job it kills it off itself but this doesn't appear to be happening.


Using EL 3
[root@xxxxx root]# rpm -qa|grep cron
vixie-cron-4.1-11.EL3
crontabs-1.10-5

I saw that for EL 4 there is an updated version of vixie-cron that in the change logs mentions something about this. What I would like to know is, will an EL4 version of cron run on EL3? or are there any other suggestions to our problem.

Happy to post more info if required.

Thanks, Justin
 
Old 02-18-2007, 07:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,293
Blog Entries: 54

Rep: Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855
What I would like to know is, will an EL4 version of cron run on EL3?
Well, you can 'rpm -U --test' it. If that doesn't work due to deps you could try rebuild the .src.rpm.


are there any other suggestions to our problem.
Here's an idea to monitor what's going on. Save script below as "run-parts-debug" to say /root/bin. Edit the script and tweak the "thresh" value to your liking. Save, make executable. Now temporarily replace the "run-parts" name in the crontab with "/root/bin/run-parts-debug". Log output is in your default syslog, grep for "
run-parts-debug". It should show a) the job it runs for, b) the load and c) the command and args. Perfunctory tested so may be a bit rough around the edges so YMMV(VM) as usual:

Code:
#!/bin/bash
# run-parts-debug
thresh=5
sleep=2s

watchThis() { logger -t run-parts-debug "Logging for $i"
pgrep -f $i >/dev/null 2>&1 && { ps wwww -eo %C -eo pid,args --sort=cpu \
| egrep "(`pgrep -s $i -d '|'`)" | while read cpu pid args; do [ "${cpu:0:1}" \
-ge $thresh ] && logger -t run-parts-debug "($i) $cpu $pid $args"; done; sleep $sleep; watchThis; }
 } 
 
runThis() { logger -t run-parts-debug "Running $i"
$i 2>&1 | awk -v "progname=$i" \ 
              'progname { 
                   print progname ":\n"
                   progname=""; 
               } 
               { print; }' 
logger -t run-parts-debug "Finished $i"
}

# run-parts - concept taken from Debian

# keep going when something fails
set +e

if [ $# -lt 1 ]; then
        echo "Usage: run-parts <dir>"
        exit 1
fi

if [ ! -d $1 ]; then
        echo "Not a directory: $1"
        exit 1
fi

# Ignore *~ and *, scripts
for i in $1/*[^~,] ; do
        [ -d $i ] && continue
        # Don't run *.{rpmsave,rpmorig,rpmnew,swp} scripts
        [ "${i%.rpmsave}" != "${i}" ] && continue
        [ "${i%.rpmorig}" != "${i}" ] && continue
        [ "${i%.rpmnew}" != "${i}" ] && continue
        [ "${i%.swp}" != "${i}" ] && continue
        [ "${i%,v}" != "${i}" ] && continue

        if [ -x $i ]; then
                runThis &
                watchThis
        fi
done

exit 0
* If you think about running this on production better make sure you test elsewhere first.
 
Old 02-19-2007, 09:53 PM   #3
Jaze
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks unSpawn, EL4 was leading towards dependancy hell so left it, don't think it's a good idea to try and resolve deps using EL4 packages on an EL3 box. have implemented your script and is logging beautifully. Cheers! Don't think I'll find out what is causing it till I get back to work tomorrow as it tends to happen at about 10/11pm AEST.
 
Old 02-20-2007, 12:44 AM   #4
sai_kiran
LQ Newbie
 
Registered: Jan 2006
Posts: 11

Rep: Reputation: 0
Post hi

Hi

I don't think you need to get the EL4 version. generally you will have updates relaesed via RHN. You can download a updated version of cron from it. Try using up2date.


Quote:
Originally Posted by Jaze
Hi all,
Using EL 3
[root@xxxxx root]# rpm -qa|grep cron
vixie-cron-4.1-11.EL3
crontabs-1.10-5

I saw that for EL 4 there is an updated version of vixie-cron that in the change logs mentions something about this. What I would like to know is, will an EL4 version of cron run on EL3? or are there any other suggestions to our problem.


Thanks, Justin
 
Old 02-21-2007, 12:22 AM   #5
Jaze
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for your post sai_kiran.

I have a problem with up2date but that's beside the point.

All rpm searches fail to find the version for EL3 that is as new as the EL4 version, which the EL4 version in the change logs specifies that it fixes the problem that I am having.
Cheers, Justin
 
Old 02-22-2007, 04:29 PM   #6
Jaze
LQ Newbie
 
Registered: Dec 2006
Posts: 14

Original Poster
Rep: Reputation: 0
Think I found the problem. Suggestion from another forum/thread somewhere, said that diskspace (or lack of it) can cause problems. so df I did, 97% used, followed by find / -size +100000000c -exec du -h {} \; someone had been using our anon_ftp for one of our sites as a repository. Found out later it was a previous employee... so much fun! Now that were back down to 67% usage, cron has stayed up no problems.

Thanks for all your help!
 
  


Reply

Tags
cron, crond


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
yes my hair is falling out cumbakwindoz Linux - Newbie 9 02-24-2007 01:11 PM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U Suse/Novell 11 01-04-2007 01:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
Help me, I'm falling off the wagon... KlaymenDK Mandriva 10 06-15-2006 02:28 AM
Slack 9.1 falling behind Trio3b Slackware 4 03-24-2005 12:17 PM


All times are GMT -5. The time now is 07:16 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration