Hi I am trying to develop a daemon using objective-C/xcode.
I am new to mac world and can I get an idea of what project template to choose in xcode and how to do it.
Can I get a simple and basic daemon sample source code ?
Hi I am trying to develop a daemon using objective-C/xcode.
I am new to mac world and can I get an idea of what project template to choose in xcode and how to do it.
Can I get a simple and basic daemon sample source code ?
The "Command Line Tool" project is sufficient to start writing a daemon. There are no special build requirements as such, it just depends on what you want the daemon to do.
The way to write a Mac OS X daemon is very much like the way you would approach it on a regular Unix system. Accordingly, there are a few things to keep in mind:
syslogd
for output, as the process is not attached to a terminalSIGHUP
forces the daemon to reload its config file)There are some good writeup on Unix daemons if you go looking. The Stephens book on Unix is always good, too.
There is some Mac specific information on daemons to consider, mainly regarding integrating with launchd
.
A typical daemon will do something like the following:
There is a simple daemon example in the Wikipedia article too.