Autostart xinetd on OSX 10.3

cell=Aside cell=To see what Apple provides, you can look at their StartupItem: Get the source for the xinetd package from [http://www.opensource.apple.com/darwinsource/10.3.9/ opensource.apple.com] -- switch to the appropriate OSX Version, if you don't have 10.3.9. Look at the files in `xinetd-26.4/StartupItem`. ---- Now all I need to do is *run xinetd automatically upon startup*. See [http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/StartupItems.html Creating a Startup Item] for some info. Note that if you use OSX 10.4 (Tiger), you should use `launchd` instead. Don't we love a changing infrastructure with every major release? :) First, create the *directory* for the StartupItem: `sudo mkdir /Library/StartupItems/xinetd` Then create two files in this directory. The first file is a script called *xinetd* (the same name as the directory): Make sure the permissions and ownerships are correct: The second file is properties file called *StartupParameters.plist*. It should have the following content: Make sure the permissions and ownerships are correct: Now xinitd should start automatically when you restart the system. You can also use SystemStarter to do this manually: `sudo SystemStarter start xinetd` Somehow this did not work for me. But when I rebooted, xinitd was running.


	#!/bin/sh
	. /etc/rc.common
	StartService ()
	{
	    ConsoleMessage "Starting TCP/IP services"
	    xinetd -pidfile /var/run/xinetd.pid
	}
	StopService ()
	{
	    ConsoleMessage "Stopping TCP/IP services"
	    kill `cat /var/run/xinetd.pid`
	}
	RestartService ()
	{
	    ConsoleMessage "Reconfigurating TCP/IP services"
	    kill -s SIGHUP `cat /var/run/xinetd.pid`
	}
	RunService "$1"
	```

sudo chown root:wheel /Library/StartupItems/xinetd/xinetd

sudo chmod 755 /Library/StartupItems/xinetd/xinetd

```


	{
	  Description     = "TCP/IP Internet services";
	  Provides        = ("Super Server");
	  Requires        = ("Resolver");
	  Uses            = ("Network Time");
	  OrderPreference = "None";
	  Messages =
	  {
	    start = "Starting TCP/IP services";
	    stop  = "Stopping TCP/IP services";
	  };
	}
	```

sudo chown root:wheel /Library/StartupItems/xinetd/StartupParameters.plist

sudo chmod 644 /Library/StartupItems/xinetd/StartupParameters.plist

```

http://www.opensource.apple.com/darwinsource/10.3.9/

http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/StartupItems.html