dotfiles/bin/vncsconnect

15 lines
376 B
Text
Raw Normal View History

2024-04-22 00:53:46 +02:00
#!/usr/bin/env sh
if [ -z "$1" ]; then
>&2 echo "provide ssh host name"
exit 1
else
2024-04-22 00:53:46 +02:00
ssh_host=$1
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"