oomd icon indicating copy to clipboard operation
oomd copied to clipboard

prekill_hooks to run a shell script

Open steverweber opened this issue 3 years ago • 0 comments

I might just be missing something obvious but the documents don't seem to have an example of hooking a bash script using prekill_hooks. I'm wondering if that is possible or something that can be added because it would add a bunch of flexibility.

My use case:

  • a university managing large shared multi user servers
  • often users have code that'll try and eat up all the memory I kill'em off when near 90% of memory

What I hope to do with oomd is catch that out of control PID or process group and use prekill_hooks to pass that information to a bash script to metric/inform admins and the user before oomd does it's magic making it hard to track down details of what was running.

In the script I would then using stdin or args find out the username and send them an email along with a simple grep of ps -aux | grep <PID?> so they know some details on what got killed.

steverweber avatar Jan 12 '22 15:01 steverweber