4 ms·
This ruby code hurts my brain, mostly because it tries to be too cute (if you want to do configuration in a ruby script, aren't you supposed to use yaml or some
by leif 16y ago
This ruby code hurts my brain, mostly because it tries to be too cute (if you want to do configuration in a ruby script, aren't you supposed to use yaml or something?). Why not just a shell script?
#!/bin/sh
LOCAL_HOST=localhost
LOCAL_PORT=22
HOST=remote.com
USER=tunnel
SSH_PORT=22
FWD_PORT=2222
OPTS=-gN
INTERVAL=300
IDENTITY=/etc/tund/key
while true
do
ssh ${OPTS} \
-p "${SSH_PORT}" \
-i "${IDENTITY}" \
-R "${FWD_PORT}:${LOCAL_HOST}:${LOCAL_PORT}" \
"${USER}@${HOST}"
sleep ${INTERVAL}
done