Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: launchctl load hangs when called via AppleScript



Hi Axel,

Thanks for your reply.

Without your myJob.plist and the code (script?) it is calling, it is rather difficult to tell...
Here's the LaunchAgent helper that tries to "hot load" other LaunchAgents that arrive in ~/Desktop/blah.  It throws the untrue "No such file or directory" error (maybe a launchd job doesn't like being asked to load another launchd job?):

<?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>Debug</key>
<string>true</string>
<key>Label</key>
<string>Backaroo Job Watcher</string>
<key>ProgramArguments</key>
<array>
<string>/bin/launchctl load -F /Users/cpu058/Desktop/Backaroo</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/cpu058/Desktop/blah</string>
</array>
</dict>
</plist>

Without your myJob.plist and the code (script?) it is calling, it is rather difficult to tell...
The tiny bit of Applescript that tries (and fails) to load a LaunchAgent is:
do shell script "launchctl load ~/Library/LaunchAgents/myJob.plist"

As well as the way and the reasons why you are calling launchtl from your ASS application.
My application wants to schedule backups, I'm trying to lever launchd's StartCalendarInterval capabilities.  I can't think of a better way of informing launchd of a new job than to use "launchctl load".

Dave.





On 28 May 2008, at 22:18, Axel Luttgens wrote:

On 28 mai 08, at 16:14, Dave Gradwell wrote:


I need to make a "launchctl load ~/Library/LaunchAgents/myJob.plist" call within an Applescript Studio application, where it appears to hang indefinitely.


The same command completes after a ~30 second hang in Script Editor.  The command *appears* to execute promptly and successfully within the Terminal, although it is followed ~30 seconds later by the near-infamous "Workaround Bonjour: Unknown error: 0" which is a tad worrying.


Not really, under Tiger... ;-)


My remedial attempts have been to:

- detach from the call and monitor it's success retrospectively (failed)

- create a launchd 'helper': a launchAgent that's loaded at startup which uses a WatchPaths hook to monitor a folder.  I hoped that newly created agents, when dropped in this folder, would 'hot load' without having to make the launchctl load call at all... however this failed: Console reports "launchd[4968]: Backaroo Job Watcher: execvp("/bin/launchctl load -F /Users/cpu058/Desktop/Backaroo", ...): No such file or directory" - which is simply not true.  (I guess a launchAgent doesn't like containing a launchctl command?)


Can anyone suggest either a solution to overcome this problem directly, or suggest an alternative means of scheduling (not Cron).


Without your myJob.plist and the code (script?) it is calling, it is rather difficult to tell...

As well as the way and the reasons why you are calling launchtl from your ASS application.

Could you provide us with somewhat more info?


TIA,

Axel


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macos-x-server mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden

References: 
 >launchctl load hangs when called via AppleScript (From: Dave Gradwell <email@hidden>)
 >Re: launchctl load hangs when called via AppleScript (From: Axel Luttgens <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.