Skip to content

Instantly share code, notes, and snippets.

View matthewdooler's full-sized avatar

Matthew Dooler matthewdooler

View GitHub Profile
@matthewdooler
matthewdooler / tunnels.sh
Last active November 2, 2018 14:31
Auto tunnels
#!/bin/bash
# Add this to crontab:
# * * * * * /Users/USERNAME/tunnels.sh
createTunnel() {
local_port=$1
remote_host=$2
remote_port=$3
nc localhost $local_port < /dev/null
if [[ $? -ne 0 ]]; then
/usr/bin/ssh -f -N -L $local_port:$remote_host:$remote_port bastion