Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
where can I insert a autorun script when the gnome logout
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
curtis123
n00b
n00b


Joined: 09 May 2004
Posts: 53

PostPosted: Sun May 09, 2004 2:37 am    Post subject: where can I insert a autorun script when the gnome logout Reply with quote

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
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Sun May 09, 2004 3:25 am    Post subject: Reply with quote

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
View user's profile Send private message
curtis123
n00b
n00b


Joined: 09 May 2004
Posts: 53

PostPosted: Sun May 09, 2004 12:33 pm    Post subject: Reply with quote

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

Code:
umount $HOME


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
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Sun May 09, 2004 2:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
curtis123
n00b
n00b


Joined: 09 May 2004
Posts: 53

PostPosted: Mon May 10, 2004 4:37 am    Post subject: Reply with quote

thanks, first execute fuser -k -m . now it works well :lol:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum