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
|
# Variables
|
||||||
declare -a ssh_args
|
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
|
# Sélectionner le viewer adapté à la session
|
||||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||||
vncviewer=wlvncc
|
vncviewer=wlvncc
|
||||||
|
@ -32,8 +37,11 @@ if [ -n "$separator" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Exécution
|
# Exécution
|
||||||
set -e
|
if ! ssh_bridge_already_exists; then
|
||||||
ssh-fwd "${ssh_args[@]}" -- "$@"
|
ssh-fwd "${ssh_args[@]}" -- "$@" || exit
|
||||||
|
else
|
||||||
|
echo "Le pont SSH existe déjà !"
|
||||||
|
fi
|
||||||
exec "$vncviewer" \
|
exec "$vncviewer" \
|
||||||
"${args[@]}"
|
"${args[@]}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue