Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support "logout" code #35

Closed
peh opened this issue Nov 16, 2015 · 6 comments
Closed

support "logout" code #35

peh opened this issue Nov 16, 2015 · 6 comments

Comments

@peh
Copy link

peh commented Nov 16, 2015

hey i have this desk that is connecting me to a VPN and does some more stuff,
it would be great if i could define some "teardown" or "logout" phase in my vpn.sh that is closing the VPN connecting and cleaning up.
similar to what .bash_logout would do.

@Shaunwei
Copy link

+1

@rnewton
Copy link
Contributor

rnewton commented Nov 17, 2015

Couldn't you just do something like...

function tear_down() {
   # Checkout all this fancy tear down code
}

alias exit="tear_down && exit"

@peh
Copy link
Author

peh commented Nov 17, 2015

seems to be ignored when hitting ctrl+d (at least on osx)

@rnewton
Copy link
Contributor

rnewton commented Nov 17, 2015

@skvale
Copy link

skvale commented Nov 21, 2015

using zsh

function tear_down() {
   # fancy tear down code
}
trap "tear_down" EXIT

works for me

@jamesob
Copy link
Owner

jamesob commented Nov 24, 2015

Looks like @skvale's solution is the way to go. If this doesn't meet anyone's usecase, please comment. Closing until then.

@jamesob jamesob closed this as completed Nov 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants