[launchd-dev] run gui LaunchAgent from launchd

James Bucanek subscriber at gloaming.com
Sat Dec 15 21:37:44 PST 2007


Bob Kells <mailto:bobkells at steelcape.com> wrote (Friday, 
December 14, 2007 5:44 PM -0800):
><?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>net.aquaconnect.acnotify</string>
><key>OnDemand</key>
><true/>
><key>Program</key>
><string>ACNotify</string>
><key>ProgramArguments</key>
><array>
><string>/Users/bob/AppSupport/ACNotify.app/Contents/MacOS/ACNotify</string>
><string>-d</string>
><string>4</string>
><string>-p</string>
><string>/Users/bob/LaunchScriptTest</string>
></array>
><key>QueueDirectories</key>
><array>
><string>/Users/bob/LaunchScriptTest</string>
></array>
><key>ServiceDescription</key>
><string>Aquaconnect Alert Notification Manager</string>
><key>WorkingDirectory</key>
><string>/Users/bob/AppSupport/ACNotify.app/Contents/MacOS</string>
></dict>
></plist>

While there doesn't seem to be anything "wrong" with this plist, 
I've found that simpler is better when trying to debug these 
things. Since your first argument is already the complete path 
to the application binary, I'd eliminate both the Program and 
WorkingDirectory keys, since they're redundant.


Bob Kells <mailto:bobkells at steelcape.com> wrote (Friday, 
December 14, 2007 6:18 PM -0800):

>launchctl load -w net.aquaconnect.acnotify.plist
>launchctl unload -w net.aquaconnect.acnotify.plist
>launchctl list
>
>Also, I have root priv when doing this.

You should be issuing user-agent requests as the user, not root. 
You want the application to be loaded/executed for ~ not root.


Bob Kells <mailto:bobkells at steelcape.com> wrote (Friday, 
December 14, 2007 6:26 PM -0800):

>That gives me an "illegal option" message.
>Am I running an old version?  How can I tell?

The -S option was added is Leopard.

-- 
James Bucanek



More information about the launchd-dev mailing list