OVPN problem
Closed this issue · 6 comments
First of all, let me congratulate you, because this program is really fantastic. I only used fzf, but yours is much nicer :)
However, I ran into a problem. For me, the beginning of the config file looks like this:
Host *
Protocol 2
IdentityFile ~/.ssh/nio
Match host SAMBA exec "nmcli connection up TRS 2> /dev/null"
Match host ICINGA2 exec "nmcli connection up TRS 2> /dev/null"
What this does is open an opvn connection for the listed servers. This works fine. However, when I exit the server, the OVPN connection does not terminate. Is there a way to tell the command to run a local command when I exit the server? I have an script, when solved this problem, if I use base ssh command:
#!/bin/bash
eval ssh '$@'
rc=$?
nmcli connection down TRS > /dev/null 2>&1
exit "$rc"
Hello! This seems like an ssh issue and not sshs isn't it? I don't think there is an "exit" match trigger in ssh.
I wonder if you can use LocalCommand
to execute a command after the session is terminated 🤔
Hello! This seems like an ssh issue and not sshs isn't it? I don't think there is an "exit" match trigger in ssh.
I wonder if you can use
LocalCommand
to execute a command after the session is terminated 🤔
Sorry. I modified the original post because I solved closing OVPN with an ssh wrapper. I included the script for this in the first post. So it would actually be just a feature request to have an option to enter a command when you exit a server. Localcommand is not good for this because it runs immediately upon connection. I use it to display in color which server I have connected to. So this ticket is only feature request.
Would something like sshs --onexit "echo 'bye'"
match your need?
Would something like
sshs --onexit "echo 'bye'"
match your need?
Yes. It would be great!
Hey! It will be available in the next release. Here is an example for your use-case:
sshs --on-session-end-template='bash -c "nmcli connection down TRS > /dev/null 2>&1"'
It's an handlebars template like the --template
option so you can pass the host's informations like the host's name
sshs --on-session-end-template='echo "{{ name }}"'
Let me know if that works for you :)
Hey! It will be available in the next release. Here is an example for your use-case:
sshs --on-session-end-template='bash -c "nmcli connection down TRS > /dev/null 2>&1"'
It's an handlebars template like the
--template
option so you can pass the host's informations like the host's namesshs --on-session-end-template='echo "{{ name }}"'
Let me know if that works for you :)
Whoa! Working fine! Thank u so much. Now it is almost perfect :)