forked from ahurac/dotfiles
Ajout : vérifier que le pont SSH n'existe pas déjà dans vncsconnect
This commit is contained in:
parent
b5c6748db6
commit
b8abeecd32
1 changed files with 10 additions and 2 deletions
|
@ -3,6 +3,11 @@
|
|||
# Variables
|
||||
declare -a ssh_args
|
||||
|
||||
# Fonction
|
||||
ssh_bridge_already_exists() {
|
||||
[ -n "$(lsof -nP -i TCP -s TCP:LISTEN | awk '($1 == "ssh" && $9 ~ /.*:'"${1}"'/) { print }')" ]
|
||||
}
|
||||
|
||||
# Sélectionner le viewer adapté à la session
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
vncviewer=wlvncc
|
||||
|
@ -32,8 +37,11 @@ if [ -n "$separator" ]; then
|
|||
fi
|
||||
|
||||
# Exécution
|
||||
set -e
|
||||
ssh-fwd "${ssh_args[@]}" -- "$@"
|
||||
if ! ssh_bridge_already_exists; then
|
||||
ssh-fwd "${ssh_args[@]}" -- "$@" || exit
|
||||
else
|
||||
echo "Le pont SSH existe déjà !"
|
||||
fi
|
||||
exec "$vncviewer" \
|
||||
"${args[@]}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue