« Return to Thread: launchd question

Re: launchd question

by huntc :: Rate this Message:

Reply to Author | View in Thread

Firstly thanks for all of the replies and sorry that I've been away  
to not answer them sooner. My responses:

On 28/02/2007, at 11:10 AM, Scott Ribe wrote:

>> I'm not sure if
>> you can presume osascript will work from launchd.
Works from cron though so I guessed that it should work from launchd.  
I originally had my osascript command as a cron job and thought I'd  
do the right thing and migrate to launchd.

>
> Ooh yes, you reminded me. AppleEvents requires libraries that are  
> either not
> available until a user is logged in,
My user is logged in.

> or only available to root before login.
> I forget which, because I learned that while building an obsolete  
> product
> that I haven't touched in ages. Sorry.
That's ok - I should be ok though as my user is logged in.

>
> Anyway, Dan's comment is on point: there may be issues with using  
> osascript
> when a user is not logged in.
Not in my case.

> That's probably a rather bad idea in general. launchd is BSD  
> environment oriented. OSA is more Carbon and Cocoa. I'm not sure if  
> you can presume osascript will work from launchd.
I have seen some other sample launchd configurations via Google that  
invoke osascript with a script file (as opposed to the -e immediate  
mode). So, I presume that osascript should work well.

>
> But if it's a mater of creating good plists for launchd, have you  
> seen Lingon?
Yes, a beautiful tool. I am using it.

> It could be a problem if you're trying to run it as a different  
> user than is currently logged in at the GUI.. An alternative would  
> be to run it as root - root can attach to the UIServer, no matter  
> who's logged in.
I might try running it as root for diagnostic purposes as I don't  
think it is good to do so normally.

I'll dig around more anyhow - unless there are more ideas?

Cheers,
-C
_______________________________________________
MacOSX-admin mailing list
MacOSX-admin@...
http://www.omnigroup.com/mailman/listinfo/macosx-admin

 « Return to Thread: launchd question