I know that I can run a local command when I establish a ssh connection, something which is quite useful for setting up terminal title for example.
Still, I'm looking for a solution to run a command when the ssh connection is closed.
Usage:
>ls
>ssh server2
# want to run something here on the client, this can be done with .ssh/config ProxyCommand
>ls
>exit
# I want to run something on the client, how!?
>ls
According to Dill on Ubuntuforums you can implement a logout script like so:
Feedback seems good to his answer. Link for reference
If you want the command to continue running after you close the SSH connnection, use the nohup command - see https://superuser.com/questions/143925/what-happens-to-running-processes-when-i-lose-a-remote-connection-to-a-nix-box