You are not logged in.

#1 2007-10-05 09:27:55

pooflinger
Member
From: Sweden
Registered: 2007-10-05
Posts: 53

[solved] How to run a script on logout?

I've just migrated from ubuntu and so far I'm really happy with Arch. GNU/Linux really is easier to 'get' with Arch. I've been able to overcome all problems so far with reading previous posts or searching for it by other means, yet this obviously elementary broblem still defies solution.

- How do I run a script on logout?

What I want to do on logout is to run 'fusermount -u ~/mounted-dir/', where 'mounted-dir' holds media from my account on another host. I have it set up so that /etc/profile runs ~/.login which in turn runs 'sshfs me@other.host:~/media/ ~/mounted-dir/ -o sshfs_sync -o reconnect'.

- Is this a reasonable way of Getting Things Done?

I suspect (as I always do) that there might be a way these things are supposed to be done, this not being it.

Last edited by pooflinger (2007-10-05 10:05:29)

Offline

#2 2007-10-05 09:53:54

oliwer
Member
From: Paris
Registered: 2007-06-30
Posts: 153
Website

Re: [solved] How to run a script on logout?

You can use a .bash_logout file wink

Offline

#3 2007-10-05 10:04:58

pooflinger
Member
From: Sweden
Registered: 2007-10-05
Posts: 53

Re: [solved] How to run a script on logout?

oliwer wrote:

You can use a .bash_logout file wink

Cheers man, that worked fine! However it only works as long as I use bash as login shell right? Do you think there's a way of doing it loginshell-independantly such as /etc/profile is for login?

Offline

#4 2007-10-05 10:32:29

_adam_
Member
From: Dora, Alabama
Registered: 2006-05-18
Posts: 94

Re: [solved] How to run a script on logout?

the problem with .bash_logout is it will run whenever you exit a bash instance.

are you using a desktop environment? do you just want this to happen prior to shutdown? or when you actually log out?

Offline

#5 2007-10-05 11:12:31

pooflinger
Member
From: Sweden
Registered: 2007-10-05
Posts: 53

Re: [solved] How to run a script on logout?

_adam_ wrote:

the problem with .bash_logout is it will run whenever you exit a bash instance.

are you using a desktop environment? do you just want this to happen prior to shutdown? or when you actually log out?

I pretty sure that .bash_logout only runs if $SHELL is /bin/bash when you log out. I want this to happen when I actually log out.

Last edited by pooflinger (2007-10-05 11:13:15)

Offline

#6 2007-10-05 12:12:34

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [solved] How to run a script on logout?

You can mount/unmount sshfs shares on startup/shutdown with /etc/fstab and /etc/rc.d/netfs.

Offline

#7 2007-10-05 20:22:31

pooflinger
Member
From: Sweden
Registered: 2007-10-05
Posts: 53

Re: [solved] How to run a script on logout?

tomk wrote:

You can mount/unmount sshfs shares on startup/shutdown with /etc/fstab and /etc/rc.d/netfs.

Thanks tomk, this is excellent information. smile

Last edited by pooflinger (2007-10-05 20:23:56)

Offline

#8 2007-10-05 23:26:12

_adam_
Member
From: Dora, Alabama
Registered: 2006-05-18
Posts: 94

Re: [solved] How to run a script on logout?

pooflinger wrote:
_adam_ wrote:

the problem with .bash_logout is it will run whenever you exit a bash instance.

are you using a desktop environment? do you just want this to happen prior to shutdown? or when you actually log out?

I pretty sure that .bash_logout only runs if $SHELL is /bin/bash when you log out. I want this to happen when I actually log out.

yeah, sorry, i forgot its only executed when a login shell is used.

Offline

Board footer

Powered by FluxBB