make sure process starts before login window
I'm looking for suggestions or examples on how to make sure a script runs before login window starts. Any ideas on how to make that happen within launchd? Thanks, Blake
At 12:02 -0700 19/8/08, Blake Garner wrote:
I'm looking for suggestions or examples on how to make sure a script runs before login window starts. Any ideas on how to make that happen within launchd?
It depends on what you mean by "before login window starts". Most folks who ask this question want to run before the user logs in [1], either before or after their home directory is mounted, and want to hold up login while they do their stuff. If that's the case then the best approach is to use an Authorization Plug-in. <http://developer.apple.com/documentation/Security/Reference/AuthorizationPluginRef/index.html> If you'd like to explore this option, drop me a line. I have a draft technote that I can send your way. OTOH if you really want to run before loginwindow is /started/ then things get a /lot/ harder. The problem is that in the launchd world we boot the system via demand pull. That is, we launch loginwindow and then, as loginwindow requests services, we start those services. So the only way to run before loginwindow is to actually patch the system to not launch loginwindow in the first place. You could do this by munging <x-man-page://5/ttys> but... yeah, that gets very ugly very fast. It might be appropriate for a managed site but it's certainly not something you'd want to do in shrinkwrap software. S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware [1] Including automatic logins.
At 22:49 +0100 19/8/08, Quinn wrote:
You could do this by munging <x-man-page://5/ttys> but... yeah, that gets very ugly very fast.
And just to prove my point, apparently the /etc/ttys hack doesn't work on 10.5 and later. The equivalent hack is munging "/System/Library/LaunchDaemons/com.apple.loginwindow.plist". Not that this is any more sensible (-: S+E -- Quinn "The Eskimo!" <http://www.apple.com/developer/> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
participants (2)
-
Blake Garner
-
Quinn