LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Distinguish between logout and shutdown in KDE / GNOME (https://www.linuxquestions.org/questions/programming-9/distinguish-between-logout-and-shutdown-in-kde-gnome-602119/)

musther 11-24-2007 12:52 PM

Distinguish between logout and shutdown in KDE / GNOME
 
I've got a script which runs after a graphical logout using either KDM or GDM.

It's called from
/etc/gdm/PostSession/Default
or
/etc/kde3/kdm/Xreset

Depending on whether you're using KDM or GDM.

What I'm trying to do now is find some way to distinguish between a user who is logging out and a user who is shutting down the machine so that I can run the script in one case, but not the other.

I'm completely stumped as to how to do this, GDM and KDM don't seem to keep track of it internally, but I suppose it doesn't change their operation. Any suggestions will be great.

Cheers

ta0kira 11-24-2007 02:39 PM

What distro? Normally you would add a line to the script which is called for shutdown on your system. In the case of Slackware, that's /etc/rc.d/rc.0. I've added a line to mine to execute a local shutdown script on my computer, which is also an rc. script.
ta0kira

musther 11-26-2007 11:25 AM

Sorry, maybe I didn't quite make this clear, the script has to be run from GDM or KDM so that X is still running and it can prompt the user graphically if required. Problem is, at that point I can't seem to distinguish between shutting down and just logging off.


All times are GMT -5. The time now is 10:01 PM.