improved vpn function

This commit is contained in:
Rouven Seifert 2023-01-03 16:11:38 +01:00
parent 01cc0c5c11
commit 7f4629e928
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
2 changed files with 12 additions and 7 deletions

View file

@ -55,7 +55,12 @@
}
function svpn() {
systemctl $(echo "start\nstop\nstatus"|fzf) $(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf)
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
if [ $(systemctl is-active $unit) = "inactive" ]; then
systemctl start $unit
else
systemctl stop $unit
fi
}
prompt_dir() {