ntripserver: move to github
[openwrt.org/packages.git] / net / sshtunnel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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"
        rm "${PIDFILE}_${$}.pid"
 
        sleep "$retrydelay" & wait
done
 
comments