Kill long running processes

Having trouble with some processes that have been running for too long?

For example php scripts that just don’t seem to stop or you do not have the time yet to find out why a cron job is running for hours and hours sometimes.

This easy oneliner lets you kill all the processes of a specific name to be killed.

The -o 30m parameter is looking if ‘processname’ has been running for longer than 30 minutes. Change this to eg 5d is you want to kill only if the process is older than 5 days.

If you want this to be done automagically, just cron this by:


Leave a Reply

Your email address will not be published. Required fields are marked *