2024-04-22 00:53:46 +02:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
>&2 echo "provide ssh host name"
|
|
|
|
exit 1
|
2023-06-17 19:52:19 +02:00
|
|
|
else
|
2024-04-22 00:53:46 +02:00
|
|
|
ssh_host=$1
|
2023-06-17 19:52:19 +02:00
|
|
|
fi
|
2024-04-22 00:53:46 +02:00
|
|
|
remote_port=${2:-5900}
|
|
|
|
local_port=$((remote_port + 4000))
|
2023-04-13 00:04:20 +02:00
|
|
|
|
2024-04-22 00:53:46 +02:00
|
|
|
ssh -O check -- "$ssh_host"
|
|
|
|
ssh -f -N -L "${local_port}:localhost:${remote_port}" -- "$ssh_host" || exit
|
|
|
|
wlvncc -- localhost "$local_port"
|
|
|
|
ssh -O cancel -L "${local_port}:localhost:${remote_port}" -- "$ssh_host"
|