Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a long cron job running a python script in CENTOS, but for some reason it seems to timeout or otherwise end without completion.

the job runs fine when executed straight from bash, but seems to stall in pretty much the same place every time when triggered by cron.

it seems like there's a timeout but apparently cron doesn't have one?

am at a loss of where to look to debug this... any pointers on where to look / how to debug are much appreciated!

share|improve this question
1  
Capture Python script stdout and stderr output to a file would be first step how to debug this –  Mikko Ohtamaa Feb 4 '12 at 15:11
    
Hi Mikko, I tried this & there were no errors in the stderr - however with karma i've found the culprit - thanks! –  significance Feb 7 '12 at 9:36
add comment

1 Answer 1

first log stdout and stderr

18 20 * * * python2.6 script.py > /test.log 2>/test.err &

also check /var/log/messages for any information.

in my case i was running out of memory!

Feb  7 03:05:12 computer kernel: Out of memory: Kill process 4915 (python2.6) score 255 or sacrifice child
share|improve this answer
    
Just an offtopic comment, Instead of using cron for Python tasks, you could try Celery. –  Bibhas Feb 7 '12 at 9:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.