"Property List" (or "plist") files can be either ASCII XML or a binary format derived from the XML. The command "plutil" is able to convert from one format to the other. With the "-lint" qualifier, you can also use plutil to check the syntax of a plist file.
Here's an example of what an ASCII plist file looks like. In this case, it's for the telnet service:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "
;http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>Label</key>
<string>com.apple.telnetd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/telnetd</string>
</array>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<false/>
</dict>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>telnet</string>
<key>Bonjour</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Launchd is run at boot time, as the first process (PID = 1) started by the kernel (like "init" in Linux systems). Launchd then fires up (and maintains) other processes, as described in its configuration files. These are plist files, and they live in several different places. The launchd man page gives the following breakdown:
~/Library/LaunchAgents Per-user agents provided by the user.
/Library/LaunchAgents Per-user agents provided by the adminis-
trator.
/Library/LaunchDaemons System wide daemons provided by the admin-
istrator.
/System/Library/LaunchAgents Mac OS X Per-user agents.
/System/Library/LaunchDaemons Mac OS X System wide daemons.
The "Daemons" items are executed as root. The "Agents" items are executed as some designated user.
The list of allowable properties in launchd plist files can be found in the launchd.plist man page. A good source of general information about launchd is this wikipedia article.
In the next article, I'll give an example of a plist file for adding a simple service to be started at boot time.
No comments:
Post a Comment