Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a lot of scripts running cron scheduled on VPS running Ubuntu 10.04. Every once in a while when server load gets heavy (I run munin as monitoring tool), I notice from my logs that many of running scripts gets killed and only thing I see is "Terminated" in the end of the log file. It's not PHP's max execution time because that's set long enough.

Is this something that my VPS provider does in order to fight against the load or is this something Ubuntu does in order to keep system responsive? According munin, my VPS is pretty weirdly configured. I see I have over 30 gigs of memory even I pay only for 512MB. Also I have noticed that I'm constantly over 512MB, especially during heavy loads. That's why I'm wondering if this is something my VPS provider does. Actually if they just came straight out and told me I'm running way too high, I would happily upgrade to 1GB package but terminating scripts without any notification isn't very good practice in my opinion.

share|improve this question

2 Answers 2

The default script timeout for PHP is 30 seconds. It can be altered in the php.ini file or via the set_time_limit() function.

share|improve this answer
I don't want to sound rude but did you even read what I wrote? It's not PHP's max execution time because that's set long enough. – James May 28 '11 at 11:53
Sorry, I missed that you were running from cron, so this is CLI environment for PHP so the default is zero or unlimited anyway. – barryj May 28 '11 at 14:03
Any chance that your long-running script is still running when cron starts another instance of it? Could this be a problem? – barryj May 28 '11 at 14:10
No, my system actually has a system built-in that allows me to create processes that can have multiple instances and processes that are restricted to one instance. I think that the problem might have been memory_limit. I don't know yet how it behaves when multiple scripts are running so it could be that I exceed memory limit and process terminates because of that. – James May 28 '11 at 17:13

Are you sure the scripts are correctly running and not erroring out in the error log? What is your current timeout set to and how have you ruled that it isn't the time limit terminating it?

share|improve this answer
I didn't find any errors in error log. I have currently set 0 to max execution which should equal to unlimited. Memory of course could be one culprit and I'm about to investigate that. Another thing I noticed was that few 3rd party classes I was using were defining their own max execution time so those could cause the problem also. – James May 28 '11 at 13:36

Your Answer


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.