launchd at logout

launchd allows you to start an application, say open a text editor, just as user gets the desktop (after logging into console) using the RunAtLoad option. Now, even though https://developer.apple.com/library/mac/documentation/macosx/conceptual/bpsystem startup/chapters/CustomLogin.html says otherwise, the logout script still works in 10.9. But it does not seem to behave the same way. What I want to do is


  1. User tells computer to log her out of the console
  2. Application is loaded and waits on user input.
  3. User does her thing with said application and closes it
  4. Logout procedure is completed and we are back to the login screen.


How can I do step 2?

Posted on Jul 15, 2014 6:12 AM

Reply
1 reply

Jul 15, 2014 11:21 AM in response to Raubvogel

The normal approach for this kind of thing is to have an app running in the background which blocks logout. If you create an applescript like the following, save it as a stay-open application, and then run it, you'll get the basic effect:

on quit

display dialog "No logout till I say so..."

if button returned of the result is "ok" then

continue quit

end if

end quit

This will cancel logout unless you click the "ok" button. You will (of course) want something more complex, but this should get you started.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

launchd at logout

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.