433147a724
git-svn-id: svn://svn.openwrt.org/openwrt/packages@21111 3c298f89-4303-0410-b956-a3cf2f4a3e73
20 lines
463 B
Bash
Executable File
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
|