A daemon template sample code for MacOS X (BSD).
You can run this daemon with:
sudo templated [start] [--daemon|--application]
-- start the daemon
sudo templated restart [--daemon|--application]
-- restart the daemon
sudo templated stop
-- stop the daemon