Standard or best way to keep alive process started by init.d [closed] Standard or best way to keep alive process started by init.d [closed] shell shell

Standard or best way to keep alive process started by init.d [closed]


You might want to use the daemon(3) library function inside the code of your daemon. You should be aware of syslog(3) (at least to log error conditions). You probably should catch gently the SIGTERM signal. Read carefully signal(7)

Server programs are often event loop based (and it is conceptually an infinite loop). You'll either use en existing event loop library (e.g. libev, libevent, glib, ...) or build your own one around a multiplexing syscall like poll(2)

Read Advanced Linux Programming and study the source code of some existing free software daemon.

Perhaps dbus is also relevant for your goals (which I don't really understand: what does "looks for down process" exactly means? You could set some limits with setrlimit(2) often invoked thru the ulimit bash builtin in some .bashrc)

There is also the @reboot entry for crontab(5), but that is not the recommended practice for system daemons (however you could use it in your user crontab file).