10.4 & 10.5 LaunchAgent compatibility
I've been working on a solution to some issues with getting OpenOffice.org.app to work in a headless state but there is some issue with the build that prevents this. So, as a work around I am trying to come up with a LaunchAgent that will load OpenOffice.org on boot and run consistently. It seems I have no choice to use LoginWindow and Aqua to keep it up regardless of whether or not a user is logged in. On 10.4.11 no matter what I do, it does not load at boot. I have to manually load it with launchctl load /Library/LaunchAgents/net.execuchoice.doc-converter.plist Obviously this is not practical. On 10.5.x it loads as expected on boot. My questions are: 1) Am I doing something wrong in the following file? 2) Is there something I can do to get this to work universally for both platforms? (10.4 & 10.5) 3) Is there a way to have this launch regardless of the LoginWindow or Aqua session type rather than have an instance close and relaunch? <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> <key>Label</key> <string>net.execuchoice.doc-converter</string> <key>LimitLoadToSessionType</key> <array> <string>LoginWindow</string> <string>Aqua</string> </array> <key>ProgramArguments</key> <array> <string>/Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin</string> <string>-headless</string> <string>-nologo</string> <string>-nofirststartwizard</string> <string>-invisible</string> <string>-accept="socket,host=127.0.0.1,port=8100;urp;"</string> </array> <key>StandardErrorPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> <key>StandardOutPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> </dict> </plist> Thanks Steffan --------------------------------------------------------------- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline Steffan@ExecuChoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : steffan@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---------------------------------------------------------------
on 2/16/09 4:51 PM, Steffan Cline at steffan@hldns.com wrote:
I've been working on a solution to some issues with getting OpenOffice.org.app to work in a headless state but there is some issue with the build that prevents this.
So, as a work around I am trying to come up with a LaunchAgent that will load OpenOffice.org on boot and run consistently. It seems I have no choice to use LoginWindow and Aqua to keep it up regardless of whether or not a user is logged in. On 10.4.11 no matter what I do, it does not load at boot. I have to manually load it with launchctl load /Library/LaunchAgents/net.execuchoice.doc-converter.plist Obviously this is not practical. On 10.5.x it loads as expected on boot.
My questions are: 1) Am I doing something wrong in the following file?
2) Is there something I can do to get this to work universally for both platforms? (10.4 & 10.5)
3) Is there a way to have this launch regardless of the LoginWindow or Aqua session type rather than have an instance close and relaunch?
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> <key>Label</key> <string>net.execuchoice.doc-converter</string> <key>LimitLoadToSessionType</key> <array> <string>LoginWindow</string> <string>Aqua</string> </array> <key>ProgramArguments</key> <array>
<string>/Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin</string> <string>-headless</string> <string>-nologo</string> <string>-nofirststartwizard</string> <string>-invisible</string> <string>-accept="socket,host=127.0.0.1,port=8100;urp;"</string> </array> <key>StandardErrorPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> <key>StandardOutPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> </dict> </plist>
Thanks
Steffan
I noticed something else too. The application does not listen on port 8100 as one might think. When I do a ps -ax | grep soffice I see the following: 565 ?? Rs 19:12.79 /Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin -headless -nologo -nofirststartwizard -invisible -accept="socket,host=127.0.0.1,port=8100;urp;" This leads me to believe it's up. In actuality, it is not listening. I am not sure why but if I manually execute this: /Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin -headless -nologo -nofirststartwizard -invisible -accept="socket,host=127.0.0.1,port=8100;urp;" & I am then able to connect to the service. What is the dealio? Is there some key I am missing? Thanks Steffan --------------------------------------------------------------- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline Steffan@ExecuChoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : steffan@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---------------------------------------------------------------
on 2/16/09 5:31 PM, Steffan Cline at steffan@hldns.com wrote:
on 2/16/09 4:51 PM, Steffan Cline at steffan@hldns.com wrote:
I've been working on a solution to some issues with getting OpenOffice.org.app to work in a headless state but there is some issue with the build that prevents this.
So, as a work around I am trying to come up with a LaunchAgent that will load OpenOffice.org on boot and run consistently. It seems I have no choice to use LoginWindow and Aqua to keep it up regardless of whether or not a user is logged in. On 10.4.11 no matter what I do, it does not load at boot. I have to manually load it with launchctl load /Library/LaunchAgents/net.execuchoice.doc-converter.plist Obviously this is not practical. On 10.5.x it loads as expected on boot.
My questions are: 1) Am I doing something wrong in the following file?
2) Is there something I can do to get this to work universally for both platforms? (10.4 & 10.5)
3) Is there a way to have this launch regardless of the LoginWindow or Aqua session type rather than have an instance close and relaunch?
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>KeepAlive</key> <true/> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> <key>Label</key> <string>net.execuchoice.doc-converter</string> <key>LimitLoadToSessionType</key> <array> <string>LoginWindow</string> <string>Aqua</string> </array> <key>ProgramArguments</key> <array>
<string>/Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin</string> <string>-headless</string> <string>-nologo</string> <string>-nofirststartwizard</string> <string>-invisible</string> <string>-accept="socket,host=127.0.0.1,port=8100;urp;"</string> </array> <key>StandardErrorPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> <key>StandardOutPath</key> <string>/Library/Logs/OpenOfficeDaemon.log</string> </dict> </plist>
Thanks
Steffan
I noticed something else too. The application does not listen on port 8100 as one might think. When I do a ps -ax | grep soffice I see the following:
565 ?? Rs 19:12.79 /Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin -headless -nologo -nofirststartwizard -invisible -accept="socket,host=127.0.0.1,port=8100;urp;"
This leads me to believe it's up. In actuality, it is not listening. I am not sure why but if I manually execute this:
/Applications/OpenOffice.org.app/Contents/MacOS/soffice.bin -headless -nologo -nofirststartwizard -invisible -accept="socket,host=127.0.0.1,port=8100;urp;" &
I am then able to connect to the service. What is the dealio? Is there some key I am missing?
Thanks
Steffan
Well, once the launchagent is working, it will restart as expected in the event of a crash. I wonder if a startup item is a fair work around to get the launchagent working? I'll have to look for a good example of a startup script for the launchagent. :-) LOL. Thanks Steffan --------------------------------------------------------------- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline Steffan@ExecuChoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : steffan@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---------------------------------------------------------------
At 15:27 -0700 17/2/09, Steffan A. Cline wrote:
Well, once the launchagent is working, it will restart as expected in the event of a crash. I wonder if a startup item is a fair work around to get the launchagent working?
Are you still talking about on 10.4.x? S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
on 2/18/09 2:43 AM, Quinn at eskimo1@apple.com wrote:
At 15:27 -0700 17/2/09, Steffan A. Cline wrote:
Well, once the launchagent is working, it will restart as expected in the event of a crash. I wonder if a startup item is a fair work around to get the launchagent working?
Are you still talking about on 10.4.x?
S+E Yes, sir. I did try this on my dev box and it works. Seems like a lame choice but what other options are there to get a gui app to run without a user logged in?
Thanks Steffan --------------------------------------------------------------- T E L 6 0 2 . 7 9 3 . 0 0 1 4 | F A X 6 0 2 . 9 7 1 . 1 6 9 4 Steffan A. Cline Steffan@ExecuChoice.net Phoenix, Az http://www.ExecuChoice.net USA AIM : SteffanC ICQ : 57234309 YAHOO : Steffan_Cline MSN : steffan@hldns.com GOOGLE: Steffan.Cline Lasso Partner Alliance Member ---------------------------------------------------------------
At 6:37 -0700 18/2/09, Steffan A. Cline wrote:
Yes, sir. I did try this on my dev box and it works. Seems like a lame choice but what other options are there to get a gui app to run without a user logged in?
Be aware that LimitLoadToSessionType is a nop on 10.4.x; launchd just doesn't look at it at all. Trying to do GUI from a launchd agent on 10.4.x is just not going to work reliably. Things will limp along for a while, but then something will happen (the user will log in or out via the GUI, or via SSH) and everything will stop working in mysterious ways. This is definitely something that Apple does not support. You'd be better off dropping support for this feature on this version of the OS, and using your engineering time to do something that's likely to yield long-term results. If you absolutely must do this on 10.4.x you will have to switch to the system login item plus global login item approach. That's also not much fun, but it can be made to work reliably. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
At 16:51 -0700 16/2/09, Steffan A. Cline wrote:
So, as a work around I am trying to come up with a LaunchAgent that will load OpenOffice.org on boot and run consistently. It seems I have no choice to use LoginWindow and Aqua to keep it up regardless of whether or not a user is logged in. On 10.4.11 no matter what I do, it does not load at boot.
launchd agents are not useful on 10.4.x because they run in an inconsistent execution context. This is called out in the "launchd Agents" section of DTS Technote TN2083 "Daemons and Agents". <http://developer.apple.com/technotes/tn2005/tn2083.html#SECLAUNCHDAGENT> I don't think you'll be able to get this to work in any reasonable manner on 10.4.x. Certainly, you will not be able to do this on 10.4.x using launchd agent. Rather, you'd have to use a combination of a system login item (to run during loginwindow) and a global login items (to run after login), neither of which is officially supported. I'd recommend that you restrict this feature to 10.5.x users. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (2)
-
Quinn
-
Steffan A. Cline