View previous topic :: View next topic |
Author |
Message |
curtis123 n00b
Joined: 09 May 2004 Posts: 53
|
Posted: Sun May 09, 2004 2:37 am Post subject: where can I insert a autorun script when the gnome logout |
|
|
gnome logout will return to gdm
but it does not run my script --> ~/.bash.logout
where can i insert my post shellscript which will autorun after the gnomesession logout |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
Posted: Sun May 09, 2004 3:25 am Post subject: |
|
|
There doesn't seem to be a good way to do this, at least not officially gnome-sanctioned.
AIUI the best thing to do is to create a ~/.xsession with:
Code: |
#!/bin/sh
gnome-session
<cleanup commands>
|
and select the "Custom" session in GDM. _________________ No more cruft
dep: Revdeps that work
Using command-line ACCEPT_KEYWORDS? |
|
Back to top |
|
|
curtis123 n00b
Joined: 09 May 2004 Posts: 53
|
Posted: Sun May 09, 2004 12:33 pm Post subject: |
|
|
thanks for ecatmur's reply
but the main purpose in my logout script ~/.bash_logout is try to unmount a device which mounted as $HOME (for example /home/user1)
I should umount it after the user logout.
the following is main content of ~/.bash_logout
it works well if I just use tty to login, when I turn to gdm, it does not autorun ~/.bash_logout when the user logout.
I tryed as ecatmur said. make a custom gnome-session
Code: | #!/bin/sh
gnome-session
~/.bash_logout |
it does run the ~/.bash_logout when the user logout and return to gdm.
but the device which I mounted as $HOME can not umount successfully. but it can umount successfully when the user use tty logout not gdm.
I think it is because it is not the proper opportunity to umount the $HOME as some process may still use the file opened in it. |
|
Back to top |
|
|
ecatmur Advocate
Joined: 20 Oct 2003 Posts: 3595 Location: Edinburgh
|
Posted: Sun May 09, 2004 2:29 pm Post subject: |
|
|
Indeed, and the foremost among those processes is the script itself (it's ~/.xsession!)
If you want to do administrative tasks i.e. stuff as root after a session ends then the place to put these tasks is /etc/X11/gdm/PostSession/Default which is run as root after a user logs out.
In there you could put e.g.
Code: | fuser -k -m /home/$USER/
umount -f /home/$USER
|
HTH. _________________ No more cruft
dep: Revdeps that work
Using command-line ACCEPT_KEYWORDS? |
|
Back to top |
|
|
curtis123 n00b
Joined: 09 May 2004 Posts: 53
|
Posted: Mon May 10, 2004 4:37 am Post subject: |
|
|
thanks, first execute fuser -k -m . now it works well |
|
Back to top |
|
|
|