Link to home
Start Free TrialLog in
Avatar of IMARTIN
IMARTIN

asked on

How to daemonize a C++ application

I am porting an application from W2K to AIX and should daemonize it. Which are the steps for making an application a daemon?
Avatar of IainHere
IainHere

This article will be useful:
http://www.cuj.com/articles/1999/9905/9905a/9905a.htm?topic=articles

To daemonize a program, you just have to register the PID with register_daemon(demo code in the article).  But that's only the start.  You'll have to respond to SIGs instead of messages, and you'll probably find a host of other incompatabilities in the source.  But if it's been written with the port in mind, it shouldn't be too bad (I've only taken apps the other way, though :-)
Avatar of stimpyjcat
Note also that the startup/shutdown semantics are different from an NT service.  Un*x daemons are usually launched from a text startup script; the location and format of these varies across different OS implementations.  You'll want to compare against an existing daemon on AIX (sendmail, routed, ftpd, sshd are a few that might be running) to use as an example.

If you're not using it for production, or this is only for personal use, it's sufficient to drop it into /etc/rc.local, which is a script indicating customized startup stuff for the local machine.
ASKER CERTIFIED SOLUTION
Avatar of mnashadka
mnashadka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial