packages/net/sshtunnel/files/sshtunnel.sh
nunojpg 08f7848a8a [packages] sshtunnel: update to version 3
git-svn-id: svn://svn.openwrt.org/openwrt/packages@24691 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-12-18 23:50:38 +00:00

21 lines
503 B
Bash

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