2

What exactly is the purpose of 'TimeOut' key in launchd plist? I thought a program specified through the first parameter of ProgramArguments will be executed after waiting seconds specified as the value of 'TimeOut'. But this is not happening. I am using Mac OS X version 10.8.2.

The Plist I used is:

<?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">
<plist version="1.0">
<dict>
 <key>Label</key>
 <string>script.test2</string>
 <key>ProgramArguments</key>
 <array>
   <string>/bin/sh</string>
   <string>/var/scripts/test2.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
 <key>StandardOutPath</key>
 <string>/tmp/test2_script.out</string>
 <key>StandardErrorPath</key>
 <string>/tmp/test2_script.err</string>
 <key>TimeOut</key>
 <integer>600</integer>
</dict>
</plist>

What I may be doing wrong here?

2

Launchd just passes the TimeOut value to the job. This is different from ExitTimeOut, which is used by Launchd to send a KILL signal to the job. Your specific requirement should be implemented within your job.

From a post in June 2010 in the Darwin-Kernel mailing list:
Re: What is TimeOut ("idle time out") in launchd?

This specifies the idle exit timeout. If your daemon hasn't received a request in this amount of time, it should quit. Notably launchd does not implement this for you; it's up for you to implement the timeout in your daemon's main event loop.

1

From the Mac Developer Library: launchd.plist(5) Mac OS X Manual Page

TimeOut <integer>
The recommended idle time out (in seconds) to pass to the job. If no value is specified, a default time out will be supplied by launchd for use by the job at check in time.

It's the recommended idle timeout.

See also: Daemons and Services Programming Guide: Creating Launch Daemons and Agents

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .