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.
The Program
key specifies the file to execute, & the ProgramArguments
key specifies the arguments which will be passed to the executing process. Strictly speaking you can pass whatever arguments you want to a process, but the convention is that the first one should be the name by which the process was invoked, so most programs ignore their first argument.‡ The file to execute is obviously necessary information, but if the Program
key is is missing, launchd pretends it has the same value as the first argument in ProgramArguments
purely as a convenience.
Your first example starts boinccmd & gives it arguments that would be equivalent to the terminal command
--host\ localhost --passwd\ gobbledygook --project\ http://setiathome.berkeley.edu/\ update
which tells boinccmd that you invoked it as "--host localhost" & only passed it two weird arguments.
Your second example separates the arguments correctly, but as Eddie Kelley suggested it needs one inserted at the front. It tells boinccmd that you invoked it as "--host", then passed another six arguments. boinccmd can recognise the last five as being two options, but has no idea what the "localhost" business is about. As far as boinccmd can tell, it was invoked from the terminal as
/Library/Application\ Support/BOINC\ Data/boinccmd localhost --passwd gobbledygook --project http://setiathome.berkeley.edu/ update
(note the missing "--host").
boinccmd is probably one of the great majority of programs that don't care what their first argument is, so you could probably actually just shove <string>HELLO</string>
at the head of the ProgramArguments
array, but it's probably cleaner to remove the Program
key altogether & just use this:
<key>ProgramArguments</key>
<array>
<string>/Library/Application Support/BOINC Data/boinccmd</string>
<string>--host</string>
<string>localhost</string>
<string>--passwd</string>
<string>gobbledygook</string>
<string>--project</string>
<string>http://setiathome.berkeley.edu/</string>
<string>update</string>
</array>
‡ It can seem like a meaningless redundancy, but some programs use this to good effect: bash et al. act as login shells if their first argument begins with -
, & Vim enters various emulation modes if its first argument is ed
or vi
instead of vim
.
Best Answer
I like the message of the day for this. As tradition dictates...
Note: /etc/motd is only displayed in a login shell, which is typical of Terminal.app on macOS. If you typically run non-login shells, you should handle display of /etc/motd in your shell dot files.