2

I want to configure a headless server to automatically reboot under catastrophic circumstances. Right now I have configured to make it panic when running out of RAM, and reboot automatically on kernel panic (sysctl kernel.panic=15 reboots 15 seconds after panic).

I want to make it also reboot when it runs out of PID (e.g. in case of a fork bomb). How should I achieve this? Note that invoking a kernel panic is also a solution.

I need a solution for Linux 5.0+ with systemd 239+, and I will appreciate if the solution is also applicable for older versions of Linux and systemd (maybe 4.9 and 237).

Note: I know how to prevent a fork bomb, but my environment makes automatic recovery more important than beforehand prevention. (i.e., resilience > resistance).

Paulo Tomé
  • 3,754
  • 6
  • 26
  • 38
iBug
  • 3,428
  • 1
  • 24
  • 57
  • 2
    Why don't you protect against something like a fork bomb by [managing resource limits](https://unix.stackexchange.com/a/85415/100397) rather than the somewhat extreme approach of a reboot? – roaima Dec 29 '19 at 21:26

0 Answers0