[launchd-dev] ~/LaunchAgent + KeepAlive=true = Login Jail

Hamish Allan hamish at gmail.com
Mon Jan 28 08:25:21 PST 2008


On Jan 28, 2008 6:16 AM, James Bucanek <subscriber at gloaming.com> wrote:

> Since my app can't tell the difference between a Quit for a
> Shutdown and a Quit just for the sake of quitting, I think I'll
> have to give up on the KeepAlive flag for this version.

You might try listening for distributed notifications associated with
shutdown and restart:

com.apple.restartInitiated
com.apple.shutdownInitiated
com.apple.logoutCancelled

(I found these on Leopard with Notification Watcher:
http://www.tildesoft.com/Programs.html)

If you get a Quit after receiving either of the first two but without
having received the third, it's a Quit for a Shutdown rather than a
Quit just for the sake of quitting.

Hamish


More information about the launchd-dev mailing list