The best option is to use
launchd the built in replacement for
xinetd. To do so you need to create an XML document (specifically a .plist) to define what you want to do. A program called Lingon provides an excellent GUI for doing this and the installation as well.
You can save the following file as
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
You then want to install this .plist within
/Library/LaunchDaemons because you want this to run when the computer starts up (as a service). You can do this by copying the file to
/Library/LaunchDaemons (User Daemons in Lingon) and running the command
sudo launchctl load -w /Library/LauchDaemons/com.example.apache2.plist. Then whenever the computer is started up, the command is run. Of note, Launch Daemons in
/Library are run as root so you don't need the sudo.
For more information on launchd, check out the man page, the man page for launchd.plist, Getting Started with launchd, or you can search here on Super User as there are several questions already about launchd.