6 .Nd System wide and per-user daemon/agent configuration files
8 This document details the parameters that can be given to an XML property list that can be loaded into
13 Daemons or agents managed by
15 are expected to behave certain ways.
17 A daemon or agent launched by
19 MUST NOT do the following in the process directly launched by
22 .Bl -bullet -offset indent -compact
25 and have the parent process
34 A daemon or agent launched by
36 SHOULD NOT do the following as a part of their startup initialization:
38 .Bl -bullet -offset indent -compact
40 Setup the user ID or group ID.
42 Setup the working directory.
48 Close "stray" file descriptors.
54 Setup resource limits with
60 Ignore the SIGTERM signal.
63 A daemon or agent launched by
67 .Bl -bullet -offset indent -compact
69 Launch on demand given criteria specified in the XML property list.
70 More information can be found in
73 Catch the SIGTERM signal.
75 .Sh XML PROPERTY LIST KEYS
76 The follow keys can be used to describe the configuration details of your daemon or agent.
77 Property lists files are expected to have their name end in ".plist" but that is not strictly required.
81 This required key uniquely identifies the job to
83 .It Sy Disabled <boolean>
84 This optional key is used to disable your job. The default is false.
85 .It Sy UserName <string>
86 This optional key specifies the user to run the job as. The default is the user who submitted the job to
88 .It Sy GroupName <string>
89 This optional key specifies the user to run the job as. The default is the group of the user who submitted the job to
91 .It Sy inetdCompatibility <dictionary>
92 The presence of this key specifies that the daemon expects to be run as if it were launched from
94 .Bl -ohang -offset indent
96 This flag corresponds to the "wait" or "nowait" option of
99 .It Sy ProgramArguments <array of strings>
100 This required key maps to the second argument of
102 .It Sy Program <string>
103 This optional key maps to the first argument of
105 If this key is missing, then the first element of the array of strings provided to the ProgramArguments will be used instead.
106 .It Sy OnDemand <boolean>
107 This optional key is used to control whether your job is launched based on demand or to be kept continuously running. The default is true.
108 .It Sy RunAtLoad <boolean>
109 This optional key is used to control whether your job is launched once at the time the job is loaded. The default is false.
110 .It Sy RootDirectory <string>
111 This optional key is used to specific a directory to
113 to before running the job.
114 .It Sy WorkingDirectory <string>
115 This optional key is used to specific a directory to
117 to before running the job.
118 .It Sy ServiceDescription <string>
119 This optional key is used to specify a human readable description of the purpose of the job.
120 .It Sy EnvironmentVariables <dictionary of strings>
121 This optional key is used to specify additional environmental variables to be setup before running the job.
122 .It Sy Umask <integer>
123 This optional key specifies what value should be passed to
125 before running the job.
126 .It Sy ServiceIPC <boolean>
127 This optional key specifies whether the job participates in advanced communication with
129 The default is false.
130 .It Sy TimeOut <integer>
131 The recommended time out to pass to the job. If no value is specified, a default time out will be supplied by
133 for use by the job at check in time.
134 .It Sy InitGroups <boolean>
135 This optional key specifies whether the job should have
137 should be called before running the job.
138 The default is false.
139 .It Sy WatchPaths <array of strings>
140 This optional key causes the job to be started if any one of the listed paths are modified.
141 .It Sy QueueDirectories <array of strings>
142 Much like the WatchPaths option, this key will watch the paths for modifications. The difference being that the job will only be started if the path is a directory and the directory is not empty.
143 .It Sy StartInterval <integer>
144 This optional key causes the job to be started every N seconds.
145 .It Sy StartCalendarInterval <dictionary of integers>
146 This optional key causes the job to be started every calendar interval as specified. Missing arguments are considered to be wildcard. The semantics are much like
149 .Bl -ohang -offset indent
150 .It Sy Minute <integer>
151 The minute on which this job will be run.
152 .It Sy Hour <integer>
153 The hour on which this job will be run.
155 The day on which this job will be run.
156 .It Sy Weekday <integer>
157 The weekday on which this job will be run (0 and 7 are Sunday).
158 .It Sy Month <integer>
159 The month on which this job will be run.
161 .It Sy StandardOutPath <string>
162 This optional key specifies what file should be used for data being sent to stdout when using
164 .It Sy StandardErrorPath <string>
165 This optional key specifies what file should be used for data being sent to stderr when using
167 .It Sy Debug <boolean>
168 This optional key specifies that
170 should adjust its log mask temporarily to LOG_DEBUG while dealing with this job.
172 .It Sy SoftResourceLimits <dictionary of integers>
173 .It Sy HardResourceLimits <dictionary of integers>
174 Resource limits to be imposed on the job. These adjust variables set with
176 The following keys apply:
177 .Bl -ohang -offset indent
178 .It Sy Core <integer>
179 The largest size (in bytes) core file that may be created.
181 The maximum amount of cpu time (in seconds) to be used by each process.
182 .It Sy Data <integer>
183 The maximum size (in bytes) of the data segment for a process; this defines how far a program may extend its break with the
186 .It Sy FileSize <integer>
187 The largest size (in bytes) file that may be created.
188 .It Sy MemoryLock <integer>
189 The maximum size (in bytes) which a process may lock into memory using the
192 .It Sy NumberOfFiles <integer>
193 The maximum number of open files for this process.
194 .It Sy NumberOfProcesses <integer>
195 The maximum number of simultaneous processes for this user id.
196 .It Sy ResidentSetSize <integer>
197 The maximum size (in bytes) to which a process's resident set size may grow.
198 This imposes a limit on the amount of physical memory to be given to a process;
199 if memory is tight, the system will prefer to take memory from processes that
200 are exceeding their declared resident set size.
201 .It Sy Stack <integer>
202 The maximum size (in bytes) of the stack segment for a process; this defines
203 how far a program's stack segment may be extended. Stack extension is
204 performed automatically by the system.
206 .It Sy Nice <integer>
207 This optional key specifies what
209 value should be applied to the daemon.
210 .It Sy LowPriorityIO <boolean>
211 This optional key specifies whether the kernel should consider this daemon to be low priority when doing file system I/O.
212 .It Sy Sockets <dictionary of dictionaries...>
213 This optional key is used to specify launch on demand sockets that can be used to let
215 know when to run the job. The job can check-in and get a copy of the file descriptors using APIs outlined in
217 The paramters below are used as inputs to call
219 .Bl -ohang -offset indent
220 .It Sy SockType <string>
221 This optional key tells
223 what type of socket to create. The default is "stream" and other valid values for this key
224 are "dgram" and "seqpacket" respectively.
225 .It Sy SockPassive <boolean>
226 This optional key specifies whether
230 should be called on the created file descriptor. The default is true ("to listen").
231 .It Sy SockNodeName <string>
232 This optional key specifies the node to
237 .It Sy SockServiceName <string>
238 This optional key specifies the service on the node to
243 .It Sy SockFamily <string>
244 This optional key can be used to specifically request that "IPv4" or "IPv6" socket(s) be created.
245 .It Sy SockProtocol <string>
246 This optional key specifies the protocol to be passed to
248 The only value understood by this key at the moment is "TCP".
249 .It Sy SockPathName <string>
250 This optional key implies SockFamily is set to "Unix". It specifies the path to
255 .It Sy Bonjour <boolean or string or array of strings>
256 This optional key can be used to request that the service be registered with the
257 .Xr mDNSResponder 8 .
258 If the value is boolean, the service name is inferred from the SockServiceName.
262 .Sh EXAMPLE XML PROPERTY LISTS
264 The following XML Property List simply keeps "exampled" running continuously:
266 .Dl <?xml version="1.0" encoding="UTF-8"?>
267 .Dl <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
268 .Dl <plist version="1.0">
271 .Dl <string>com.example.exampled</string>
272 .Dl <key>ProgramArguments</key>
274 .Dl <string>exampled</string>
276 .Dl <key>OnDemand</key>
282 .Bl -tag -width "/System/Library/LaunchDaemons" -compact
283 .It Pa ~/Library/LaunchAgents
284 Per-user agents provided by the user.
285 .It Pa /Library/LaunchAgents
286 Per-user agents provided by the administrator.
287 .It Pa /Library/LaunchDaemons
288 System wide daemons provided by the administrator.
289 .It Pa /System/Library/LaunchAgents
290 Mac OS X Per-user agents.
291 .It Pa /System/Library/LaunchDaemons
292 Mac OS X System wide daemons.