launch a script during logout

Hello

I know how to launch a script whenever I turn off my computer; I just have to add it in the file /etc/halt.local. Such a script is launched just before the computer stops. Now I’d like to launch a script whenever I log out from my account. I’d like that, each time I log out from my account for instance to let someone else work with my computer on his own account, a script is automatically launched. I know how to launch a script when logging IN but not when logging OUT. Is there anybody who has an idea on the topic?

Thanks

If you use KDE4, then place the script into the folder:

~/.kde4/shutdown

It works like a champ (~=/home/username).

Thank You,

Hi,

and in gdm (Gnome) I believe it to be:

/etc/gdm/PostSession/

(NB: to add to what jdmacsaniel3 has said : the /shutdown folder for kde isn’t created automatically, you may have to create it yourself).

HTH

Lenwolf

First off, thanks so much for adding in the GNOME info lenwolf. I don’t use GNOME and to make this thread complete we really did need that information. Now to your comment:

(NB: to add to what jdmacsaniel3 has said : the /shutdown folder for kde isn’t created automatically, you may have to create it yourself).
The KDE4 folder ~/.kde4/shutdown was already there and I did not create it. This is in KDE 4.6 though. Also, the .kde folder is not there at all and would need to be created, if you thought it was needed for some reason, but I am not sure why that would be true. Just look for the one I suggest, but indeed create it if it does not exist.

Thank You,

Notice that scripts in /etc/gdm/PostSession are not Gnome specific. They are executed when you exit a session started from the gdm session manager. So it could be a kde or any other session, such as xfce, lxde, etc (if you were using gdm).

Hmm strange, I’ve a KDE 4.6, too - and the /shutdown folder ISN’T there… Hence my remark.
Lenwolf

Thank you to everybody for their help.

Your tips run smoothly with kde or gnome.