|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
launchd questionHi there,
I've got a problematic launchd plist and I was wondering if someone could help. I'm trying to execute osascript -e <command> via launchd and it reports an error (an abort) in the system.log file. More specifically: launchd[4108]: com.classactionpl.restartvision: exited abnormally: Abort trap Here's the plist: <?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> <true/> <key>Label</key> <string>com.classactionpl.restartvision</string> <key>OnDemand</key> <true/> <key>ProgramArguments</key> <array> <string>osascript</string> <string>-e</string> <string>tell application "World" to quit</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>0</integer> <key>Minute</key> <integer>0</integer> </dict> </dict> </plist> Debug etc. doesn't yield more info. Any ideas? Cheers, -C _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
|
|
|
Re: launchd questionAt 7:45 AM +1100 2/28/07, Christopher Hunt wrote:
>Hi there, > >I've got a problematic launchd plist and I was wondering if someone >could help. I'm trying to execute osascript -e <command> via launchd >and it reports an error (an abort) in the system.log file. More >specifically: 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. But if it's a mater of creating good plists for launchd, have you seen Lingon? -- -dhan ------------------------------------------------------------------------ Dan Shoop AIM: iWiring Systems & Networks Architect http://www.ustsvs.com/ shoop@... http://www.iwiring.net/ 1-714-363-1174 "The wise man doesn't give the right answers, he poses the right questions." -- Claude Levi-Strauss ------------------------------------------------------------------------ iWiring provides systems and networks support for Mac OS X, unix, and Open Source application technologies at affordable rates. _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd question> I'm not sure if
> you can presume osascript will work from launchd. Ooh yes, you reminded me. AppleEvents requires libraries that are either not available until a 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. Anyway, Dan's comment is on point: there may be issues with using osascript when a user is not logged in. -- Scott Ribe scott_ribe@... http://www.killerbytes.com/ (303) 722-0567 voice _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionFirstly 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 |
|
|
Re: launchd questionOn 27/02/07 21:45, Christopher Hunt wrote:
> Hi there, > > I've got a problematic launchd plist and I was wondering if someone > could help. I'm trying to execute osascript -e <command> via launchd > and it reports an error (an abort) in the system.log file. More > specifically: > > launchd[4108]: com.classactionpl.restartvision: exited abnormally: > Abort trap > > Here's the plist: > > [...] > <key>OnDemand</key> > <true/> (anecdotical) This is the default. But from your description in subsequent posts, you don't seem to need an on-demand behavior. I would thus set this one to false. > <key>ProgramArguments</key> > <array> > <string>osascript</string> Wouldn't a full path (ie /usr/bin/osascript) be needed here? > <string>-e</string> > <string>tell application "World" to quit</string> > </array> > [...] > > Debug etc. doesn't yield more info. > > Any ideas? Well, frankly, I would stay with cron... ;-) Since 10.4 and up to 10.4.8, I have been unable to *reliably* use launchd for tasks needing to be launched at regular intervals; it somehow works, if one may allow some timing inacurracies, but sometimes with big surprises. HTH, Axel _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionI've just made a discovery that I think is worth sharing.
Firstly I have a user that can administer the computer (user A) and one that can't (user B). If I issue a launchctl start from the command line for user A then the osascript -e <command> works! Of course this is not the case for user B. However if I perform a "launchd bash", load the plists and the perform the launchctl start (all for user B)s then all is well! I'm confused... if things work under launchd bash then why shouldn't they outside of that shell? Cheers, -C _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionLatest update: I think that my problem has something to do with
either the sequence of when Finder is launched and/or whether Finder is even present. I didn't think it important to mention that the user B account is also a kiosk style of account i.e. a custom application is launched in place of Finder. Perhaps this is causing the problem... Oh well... I've had to resort back to cron as my scheduled osascript command worked just fine there. I would like to get launchd working for me though so please keep coming through with any other ideas. Cheers, -C On 28/02/2007, at 8:26 PM, Christopher Hunt wrote: > I've just made a discovery that I think is worth sharing. > > Firstly I have a user that can administer the computer (user A) and > one that can't (user B). If I issue a launchctl start from the > command line for user A then the osascript -e <command> works! Of > course this is not the case for user B. > > However if I perform a "launchd bash", load the plists and the > perform the launchctl start (all for user B)s then all is well! > > I'm confused... if things work under launchd bash then why > shouldn't they outside of that shell? MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 28/02/07 10:26, Christopher Hunt wrote:
> I've just made a discovery that I think is worth sharing. > > Firstly I have a user that can administer the computer (user A) and > one that can't (user B). If I issue a launchctl start from the > command line for user A Without sudo? Is user A the root user? > then the osascript -e <command> works! Of course this is not the case > for user B. > > However if I perform a "launchd bash", load the plists and the > perform the launchctl start (all for user B)s then all is well! > > I'm confused... if things work under launchd bash then why shouldn't > they outside of that shell? With "launchd bash", you have created a *second* instance of launchd, running with your user privileges. By using launchctl (without sudo), you are then implicitely targeting that second instance, upon which you have full control (loading services, starting services...). HTH, Axel _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionReally, the last update this time. :-)
I managed to re-direct the output of stderr to a file via launchd (very option that one): 2007-02-28 22:38:10.503 osascript[9069] CFLog (0): CFMessagePort: bootstrap_register(): failed 1100 (0x44c), port = 0x2103, name = 'Processes-0.35782657' See /usr/include/servers/bootstrap_defs.h for the error codes. 2007-02-28 22:38:10.511 osascript[9069] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (Processes-0.35782657) CFMessagePortCreateLocal failed (name = Processes-0.35782657 error = 0) The error code 1100 equates to BOOTSTRAP_NOT_PRIVILEGED. This is all that I could find on this error: *** A deactivated bootstrap namespace allows you to look up services, but it does not allow you to register new services. Any attempt to register a service in a deactivate namespace will fail with an error BOOTSTRAP_NOT_PRIVILEGED (1100). Similarly, any high-level wrapper that registers a service will fail. For example, CFMessagePortCreateLocal will print an error message and return NULL if you call it after your namespace has been deactivated. *** Any ideas? Cheers, -C On 28/02/2007, at 10:04 PM, Christopher Hunt wrote: > Latest update: I think that my problem has something to do with > either the sequence of when Finder is launched and/or whether > Finder is even present. I didn't think it important to mention that > the user B account is also a kiosk style of account i.e. a custom > application is launched in place of Finder. Perhaps this is causing > the problem... > > Oh well... I've had to resort back to cron as my scheduled > osascript command worked just fine there. I would like to get > launchd working for me though so please keep coming through with > any other ideas. > > Cheers, > -C > > On 28/02/2007, at 8:26 PM, Christopher Hunt wrote: > >> I've just made a discovery that I think is worth sharing. >> >> Firstly I have a user that can administer the computer (user A) >> and one that can't (user B). If I issue a launchctl start from the >> command line for user A then the osascript -e <command> works! Of >> course this is not the case for user B. >> >> However if I perform a "launchd bash", load the plists and the >> perform the launchctl start (all for user B)s then all is well! >> >> I'm confused... if things work under launchd bash then why >> shouldn't they outside of that shell? MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 28/02/07 13:32, Christopher Hunt wrote:
> Really, the last update this time. :-) > > I managed to re-direct the output of stderr to a file via launchd > (very option that one): > > 2007-02-28 22:38:10.503 osascript[9069] CFLog (0): CFMessagePort: > bootstrap_register(): failed 1100 (0x44c), port = 0x2103, name = > 'Processes-0.35782657' > See /usr/include/servers/bootstrap_defs.h for the error codes. > 2007-02-28 22:38:10.511 osascript[9069] CFLog (99): > CFMessagePortCreateLocal(): failed to name Mach port > (Processes-0.35782657) > CFMessagePortCreateLocal failed (name = Processes-0.35782657 error = 0) > > The error code 1100 equates to BOOTSTRAP_NOT_PRIVILEGED. This is all > that I could find on this error: > > *** > A deactivated bootstrap namespace allows you to look up services, but > it does not allow you to register new services. Any attempt to > register a service in a deactivate namespace will fail with an error > BOOTSTRAP_NOT_PRIVILEGED (1100). Similarly, any high-level wrapper > that registers a service will fail. For example, > CFMessagePortCreateLocal will print an error message and return NULL > if you call it after your namespace has been deactivated. > *** > > Any ideas? Where have you saved the plist? In /S/L/LaunchDaemons? In /L/LaunchDaemons? Or in ~/L/LaunchDaemons, where ~ denotes the home directory of the user who is running application "World" (the one to be quit at 00:00)? If the latter, the plist should automatically be read and loaded when the user logs in, within the correct context. HTH, Axel _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 28/02/07 14:03, Axel Luttgens wrote:
> [...] > >> > > > Where have you saved the plist? > In /S/L/LaunchDaemons? > In /L/LaunchDaemons? > Or in ~/L/LaunchDaemons, where ~ denotes the home directory of the > user who is running application "World" (the one to be quit at 00:00)? > > If the latter, the plist should automatically be read and loaded when > the user logs in, within the correct context. Sorry, I meant "LaunchAgents" instead of "LaunchDaemons" in the above. Axel _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionAt 10:04 PM +1100 2/28/07, Christopher Hunt wrote:
>Latest update: I think that my problem has something to do with >either the sequence of when Finder is launched and/or whether Finder >is even present. Finder??? As I said earlier this is all entirely inappropriate concepts to be canting in the same breath as launchd. > I didn't think it important to mention that the user B account is >also a kiosk style of account i.e. a custom application is launched >in place of Finder. Perhaps this is causing the problem... Kiosk? I smell wool -- -dhan ------------------------------------------------------------------------ Dan Shoop AIM: iWiring Systems & Networks Architect http://www.ustsvs.com/ shoop@... http://www.iwiring.net/ 1-714-363-1174 "The wise man doesn't give the right answers, he poses the right questions." -- Claude Levi-Strauss ------------------------------------------------------------------------ iWiring provides systems and networks support for Mac OS X, unix, and Open Source application technologies at affordable rates. _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 2/28/07, Christopher Hunt <huntc@...> wrote:
> I didn't think it important to mention that the user > B account is also a kiosk style of account i.e. a custom application > is launched in place of Finder. Perhaps this is causing the problem... Do you think? -- Jared Earle :: There is no SPORK jearle@... :: http://www.23x.net The Spodcast :: http://spodcast.org _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionWell it appears that what I'm trying to do (create a LaunchAgent for
a specific user that issues an osascript command) is legitimate; it just doesn't work for Tiger. More specifically LaunchAgents don't work too well on Tiger. However Leopard apparently fixes things up. I have this advice from the "horses mouth" a.k.a. the guy in Apple that looks after launchd. Here are excerpts of his replies at the launchd-dev@... forum after having explained my problem: > Known bug in Tiger, and fixed in Leopard. > For most practical purposes, LaunchAgents don't function as > advertised in Tiger. > You can use them as long as you never logout. In other words avoid LaunchAgents for Tiger. 'hope that this has been useful - it has been for me! Cheers, -C _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 28-Feb-2007, at 16:21, Christopher Hunt wrote:
> dev@... forum after having explained my problem: >> Known bug in Tiger, and fixed in Leopard. >> For most practical purposes, LaunchAgents don't function as >> advertised in Tiger. >> You can use them as long as you never logout. > > In other words avoid LaunchAgents for Tiger. I don't think it is at all that simple. Every LaunchAgent I've PROPERLY setup has worked just fine. However, osascript ASSUMES the Finder is present, so without a finder it's going to be weird. I suspect there's more to this than simply "they don't work". -- Lister: What d'ya think of Betty? Cat: Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma. Lister: This is crazy. Why are we talking about going to bed with Wilma Flintstone? Cat: You're right. We're nuts. This is an insane conversation. Lister: She'll never leave Fred, and we know it. _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
|
|
|
Re: launchd questionHi Dan,
On 01/03/2007, at 2:26 AM, Dan Shoop wrote: > At 10:04 PM +1100 2/28/07, Christopher Hunt wrote: >> Latest update: I think that my problem has something to do with >> either the sequence of when Finder is launched and/or whether >> Finder is even present. > > Finder??? Finder is the application that runs upon logging in - it provides the ability to move and manipulate the file system. The application is located at: /System/Library/CoreServices/Finder.app A nice definition: http://en.wikipedia.org/wiki/Macintosh_Finder > > As I said earlier this is all entirely inappropriate concepts to be > canting in the same breath as launchd. Well, I'm not sure why - the Finder is not the WindowServer. Additionally the equivalent job works fine under crontab as I explained before. Apple have explained that there are problems with LaunchAgents in the current OS X. > >> I didn't think it important to mention that the user B account is >> also a kiosk style of account i.e. a custom application is >> launched in place of Finder. Perhaps this is causing the problem... > > Kiosk? A Kiosk is an application designed to keep the user in a captured environment generally such that they cannot manipulate the file system and operate the desktop in regular ways. An example of a kiosk is an Internet Kiosk in an airport. Here's a link for you: http://developer.apple.com/technotes/tn2002/tn2062.html ...and another: http://en.wikipedia.org/wiki/Interactive_kiosk > I smell wool You must live in New Zealand then. ;-) Cheers, -C _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionOn 1/03/07 21:41, Christopher Hunt wrote:
> On 02/03/2007, at 7:00 AM, macosx-admin-request@... wrote: > >> [...] >> I don't think it is at all that simple. >> Every LaunchAgent I've >> PROPERLY setup has worked just fine. > > As Apple said, as long as you don't log out then all should be well. > Do you log out? > >> However, osascript ASSUMES the >> Finder is present, so without a finder it's going to be weird. > > So how come then that cron works just fine for me? I have a crontab > for the specific user - same user, same environment, same command. > The osascript doesn't work under launchd but it does under cron. > >> >> I suspect there's more to this than simply "they don't work". > > I'm curious as to whether you're logging out or not. If you're not > logging out then things might be fine for you. I would agree with you, Christopher: whether the Finder is present or not shouldn't have any impact in this case. On the other hand, according to your various emails, it seems you are encountering problems even within a Finder environment (but I may be wrong: I sometimes felt lost). So, it would be nice to compare what's happening on your box against another one. (let's first start with very basic facts...) Could you try the following, and tell us whether you observe dissimilar behaviors? 1. Create a regular user "test", without admin rights. 2. Put this one into ~test/Library/LaunchAgents: <?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> <true/> <key>Label</key> <string>com.classactionpl.restartvision</string> <key>OnDemand</key> <true/> <key>ProgramArguments</key> <array> <string>osascript</string> <string>-e</string> <string>tell application "TextEdit" to quit</string> </array> <key>StartInterval</key> <integer>60</integer> </dict> </plist> 3. Do various log in/out as described in following comented excerpt of system.log: 3.1. Log in as user "test": Mar 3 11:11:06 ALMbp /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow: Login Window Application Started Mar 3 11:11:06 ALMbp loginwindow[1242]: Login Window Started Security Agent Wait 5-6 minutes; as the target of the Quit event, TextEdit is quickly launched then quit every minute. On the other hand, if TextEdit is already running because user "test" has launched it, it is just quit. Everything thus "works" as expected. 3.2. Now, log out, then log in as user "test" again: Mar 3 11:17:23 ALMbp /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow: Login Window Application Started Mar 3 11:17:23 ALMbp loginwindow[1287]: Login Window Started Security Agent Mar 3 11:18:15 ALMbp launchd[1255]: com.classactionpl.restartvision: exited abnormally: Abort trap Mar 3 11:18:15 ALMbp launchd[1255]: com.classactionpl.restartvision: 9 more failures without living at least 60 seconds will cause job removal [...] Mar 3 11:26:15 ALMbp launchd[1255]: com.classactionpl.restartvision: exited abnormally: Abort trap Mar 3 11:26:15 ALMbp launchd[1255]: com.classactionpl.restartvision: 1 more failure without living at least 60 seconds will cause job removal Mar 3 11:27:15 ALMbp launchd[1255]: com.classactionpl.restartvision: exited abnormally: Abort trap Mar 3 11:27:15 ALMbp launchd[1255]: com.classactionpl.restartvision: too many failures in succession As expected, we have encountered that well-know problem with launch agents: they don't quit with the user's session, so that they have lost their context on subsequent logins. Here, having waited long enough to allow for 10 failures, the job thus gets unloaded. 3.3. So, log out, then log in as user "test" again: Mar 3 11:28:12 ALMbp /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow: Login Window Application Started Mar 3 11:28:12 ALMbp loginwindow[1333]: Login Window Started Security Agent As expected, the job is re-loaded and everything works fine with TextEdit again. 3.4. Log out, then log in as another user on the box: Mar 3 11:29:37 ALMbp /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow: Login Window Application Started Mar 3 11:29:37 ALMbp loginwindow[1363]: Login Window Started Security Agent Mar 3 11:30:20 ALMbp osascript: kCGErrorRangeCheck : Window Server communications from outside of session allowed for root and console user only Mar 3 11:30:20 ALMbp launchd[1346]: com.classactionpl.restartvision: exited abnormally: Abort trap Mar 3 11:30:20 ALMbp launchd[1346]: com.classactionpl.restartvision: 9 more failures without living at least 60 seconds will cause job removal [...] Exactly what was to be expected, thus... Axel _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
|
|
Re: launchd questionHi Axel,
I haven't yet tried the steps that you outlined - but I'm sold with your convincing reproduction of what I've been seeing. Let me answer a few specifics: On 03/03/2007, at 10:41 PM, Axel Luttgens wrote: > I would agree with you, Christopher: whether the Finder is present > or not shouldn't have any impact in this case. Great. > On the other hand, according to your various emails, it seems you > are encountering problems even within a Finder environment (but I > may be wrong: I sometimes felt lost). Many apologies for the confusion. The source of the confusion I feel has to do with fast user switching. Now that I think about it, the user that worked just fine was the first user I logged in with (this user had the Finder launched). The user I switched to from the first user demonstrated the problem (this user had no Finder). I'll bet that if I had of completely logged out, logged in to the second user, have the job unload and then log out/log back in (effectively all that you've done) then all would have been well for that second user i.e. nothing to do with the presence of the Finder. > > So, it would be nice to compare what's happening on your box > against another one. > (let's first start with very basic facts...) > > Could you try the following, and tell us whether you observe > dissimilar behaviors? I can give it a go on Monday when I'm back in the office, but I'm sure you've nailed it. In a nutshell, "don't use LaunchAgents with Tiger unless you stay logged in" seems to be holding up. Cheers, -C _______________________________________________ MacOSX-admin mailing list MacOSX-admin@... http://www.omnigroup.com/mailman/listinfo/macosx-admin |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |