Actually your question is a particular application of the famous "Quis custodiet ipsos custodes?" that is "Who will guard the guards?".
In a modern Linux system the central guarding point is init
process (the process number 1). If init
dies, the Linux kernel immediately panics, and thus you have to go to your data center (I mean go afoot) and press reset
button. There're a lot of alternative init
implementations, here is one of those "comparison tables" :)
The precise answer how to configure a particular init
implementation depends on what init
version you use in that system. For example systemd
has its own machinery for configure service restart upon their deaths (directives Restart=
, RestartSec=
, WatchdogSec=
etc in a corresponding unit-file. Other init implementations like Ubuntu Upstart also has its analogues (respawn
directive in a service configuration file). Even old good SysV init has respawn
option for a service line in /etc/inittab
, but usually user-level services aren't started directly inittab, only virtual console managers (getty
, mgetty
etc)