S
S
SuperPetrovich2015-06-21 21:04:00
linux
SuperPetrovich, 2015-06-21 21:04:00

Kill a program consuming more than X bytes of memory?

subject
// maybe the question has already been answered and the question can help someone, please do not delete it

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2015-06-21
@SuperPetrovich

while true; do; ps-auxh | awk '{if ($6 >= N) print $2}'| xargs kill -9; sleep 5 ; done
Where N is the size. $6 - data column. It is better to check carefully, with -9 then. Additionally, it is not superfluous to check pid for a size higher than 1000, so as not to kill init, for example.

S
Spetros, 2015-06-21
@Spetros

This is very simple: take the bash manual and write a script that will periodically check the system and send a 9 KILL signal to those processes that use RSS memory more than the specified N.
Nothing complicated. You just need to pick up and write.
Instead of a lazy person and an ignoramus, no one will write a script with its given N.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question