Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: detecting logout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: detecting logout

On 1 Feb 2005, at 19:57, Pete Gontier wrote:

I am developing a per-user bootstrap daemon. This program used to be a
startup item, but for obscure reasons not relevant to the problem at hand,
it became necessary to morph it into a per-user bootstrap daemon (and not,
it should be noted, a global bootstrap daemon). The key difference between
the two forms of program for purposes of this discussion is that a startup
item launches once at startup and a per-user bootstrap daemon launches
whenever a user logs in. This means that there may be many instances of a
single per-user bootstrap daemon, which is fine. The trick is knowing when
each instance should quit. When the user logs out, per-user bootstrap
daemons are not automagically killed, which I suppose may be a feature to
someone somewhere. For me, it presents a problem, because there is no reason
for an instance of my program to hang around after the user logs out. The
trick is knowing when that is.

Does the user's .logout script (or whatever alternative bash has) get run when they log out of the console environment? If so, you launch your daemon from .login, and cause it to write its pid into ~/, and then .logout contains the line "kill -QUIT `cat ~/`".

Of course, if it doesn't get run, then you probably need to use a logouthook. But that would make you a customer of the WindowServer, which you don't want (understandably, because then users who ssh in don't get to kill their daemons).

Just thinking out IDE is and all that.



Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

 >detecting logout (From: Pete Gontier <email@hidden>)

Visit the Apple Store online or at retail locations.

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.