Gnome i script

On hauria de col·locar un script per tal que s'executi en tancar gnome?
El mateix en iniciar gnome.
Gràcies
Potser no és el lloc més adient però tens:

usuari@linux:~> cat /etc/opt/gnome/gdm/gdm.conf | grep Post
PostLoginScriptDir=/etc/opt/gnome/gdm/PostLogin/
PostSessionScriptDir=/etc/opt/gnome/gdm/PostSession/
usuari@linux:~> cat /etc/opt/gnome/gdm/gdm.conf | grep Pre
# Note that a post login script is run before a PreSession script.
PreSessionScriptDir=/etc/opt/gnome/gdm/PreSession/

Per exemple.

usuari@linux:~> cat /etc/opt/gnome/gdm/PostSession/Default
#!/bin/sh

exec /home/usuari/prova

exec /etc/X11/xdm/Xreset

exit 0
usuari@linux:~> cat prova
#!/bin/sh

touch $HOME/flag
usuari@linux:~> ls fl*
flag

La idea és d'en Joan de Gracia, potser ell ho haurà investigat més.