Since almost all UDP-based servers are iterative by nature, the best way to launch and monitor them is by making use of the super server inetd. Add a line like the one below to the /etc/inetd.conf file:
elfLogServer dgram udp wait elfuser
/apps/elf/logserver/elfLogserver elfLogserver -u -f
/etc/elfLogserver.conf
You should accompany these additions to inetd.conf with another line in the /etc/services file:
elfLogServer udp/50000 # port for elflogserver = 50000
Once you have added these entries and inetd is notified of the configuration changes (usually with a kill -SIGHUP <pid>), even if the log server crashes, inetd will relaunch it automatically when the next logging request comes in.
If you are operating the log server in TCP mode, or if the company policy does not allow you to modify any of the /etc files, use the daemonLauncher script included with the source files at the CUJ web site (http://www.cuj.com/code/). daemonLauncher is a general-purpose script for launching and monitoring high-availability daemon processes. The script works by launching the actual binary in a loop, as follows:
while : ; do /binary/executable/path done
This approach ensures that the daemon process is relaunched immediately if it dies. Since the monitoring shell (K shell or Bourne shell, for instance) is a highly stable piece of software, it generally will not crash unless somebody explicitly kills it.
S.A.
Back to Article