0

I have a long-running cron process, running a Python script, that seems to get randomly killed. In dmesg I see:

[230568.077358] init: cron main process (890) killed by TERM signal
[237517.974422] init: cron main process (19598) killed by TERM signal

How do I stop this from happening? I tried running the process via a lower nice value, e.g.

* * * * * nice -n 10 bash -c "/usr/local/myproject/myscript.py"

but it still gets killed. How do I diagnose and fix this?

Cerin
  • 3,600
  • 19
  • 61
  • 79
  • Nothing is random in computing. Do you perhaps have a resource limit set somewhere on your system (maximum execution time? max CPU time?) that you are hitting? – voretaq7 Aug 02 '13 at 16:49
  • @voretaq7, It's a stock Ubuntu 12.04 installation, so no, I don't think so. – Cerin Aug 02 '13 at 17:58

2 Answers2

1

Your script is being killed as a secondary effect. The log message indicates that cron itself is being killed. When a process with child processes is killed, it sends a SIGHUP to its children, causing them to exit as well. That's what's killing your python script.

If the log line you list line is immediately followed by a line that says init: cron main process ended, respawning, then you know that something outside of init/upstart killed it and it was automatically respawned. If that message does not exist, then cron was killed by init/upstart, the same as if you ran "sudo restart cron" or "sudo stop cron".

So your new research project is figuring out what is either killing or shutting down cron.

Insyte
  • 9,394
  • 3
  • 28
  • 45
0

Probably your process is toooo long runnig and cron blocks on it.

Tyr runnig your process in background. To do this just add an "&" and the end.

pbacterio
  • 276
  • 2
  • 6