mirror of
https://git.sr.ht/~rouven/nixos-config
synced 2025-04-26 00:18:28 +02:00
improved vpn function
This commit is contained in:
parent
01cc0c5c11
commit
7f4629e928
2 changed files with 12 additions and 7 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue