1

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!

  • 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
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
  • Just an offtopic comment, Instead of using cron for Python tasks, you could try Celery. – Bibhas Feb 7 '12 at 9:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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