nunojpg 433147a724 [packages] add sshtunnel, Manages Local and Remote openssh ssh(1) tunnels
git-svn-id: svn://svn.openwrt.org/openwrt/packages@21111 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-04-23 14:48:26 +00:00

20 lines
463 B
Bash
Executable File

#!/bin/sh
PIDFILE="/tmp/run/sshtunnel"
args=$1
retrydelay=$2
while true
do
logger -p daemon.info -t "sshtunnel[$$]" "connecting: ssh $args"
start-stop-daemon -S -p "$PIDFILE"_"$$".pid -mx ssh -- $args &>/tmp/log/sshtunnel_$$
logger -p daemon.err -t "sshtunnel[$$]" < /tmp/log/sshtunnel_$$
rm /tmp/log/sshtunnel_$$
logger -p daemon.info -t "sshtunnel[$$]" "ssh exited with code $?, retrying in $retrydelay seconds"
sleep "$retrydelay" & wait
done