Create Auto respawn Daemon

Use /etc/inittab to have init watch a program or script and start it over if it fails. Here is an example entry:
zz:12345:respawn:/path/to/my_daemon

Here is an example to run as non-root
zz:12345:respawn:/usr/bin/sudo -u user1 /path/to/my_daemon

Notes:

  • zz code mut be unique in inittab for each process; 12345 represents run levels to include
  • Comment out entry in inittab if want to stop daemon
  • After changes to inittab you need to ‘kill -HUP’ init process
Advertisements

Comments are closed.

%d bloggers like this: