Changeset 24807


Ignore:
Timestamp:
2010-12-23T00:14:01+01:00 (5 years ago)
Author:
nunojpg
Message:

[packages] sshtunnel: bug fix

Location:
packages/net/sshtunnel/files
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • packages/net/sshtunnel/files/initd_sshtunnel

    r24716 r24807  
    136136        [ "$count" -eq 0 ]      && { logger -p user.err -t "sshtunnel" "tunnels to $server not started - no tunnels defined"; return; } 
    137137 
    138         append_params CheckHostIP Compression CompressionLevel IdentityFile LogLevel PKCS11Provider ServerAliveCountMax ServerAliveInterval StrickHostKeyChecking TCPKeepAlive VerifyHostKeyDNS 
     138        append_params CheckHostIP Compression CompressionLevel IdentityFile LogLevel PKCS11Provider ServerAliveCountMax ServerAliveInterval StrictHostKeyChecking TCPKeepAlive VerifyHostKeyDNS 
    139139        ARGS="$ARGS_options -o ExitOnForwardFailure=yes -o BatchMode=yes -nN $ARGS_tunnels $user@$hostname" 
    140140 
    141141        /usr/bin/sshtunnel.sh "$ARGS" "$retrydelay" "$server" & 
    142         echo $! >> "$PIDFILE".pids 
     142        echo $! >> "${PIDFILE}.pids" 
    143143        logger -p user.info -t "sshtunnel" "started tunnels to $server (pid=$!;retrydelay=$retrydelay)"  
    144144} 
     
    151151                while read pid 
    152152                do 
    153                         start-stop-daemon -K -p "$PIDFILE"_"$pid".pid 
    154                         kill $pid 
     153                        kill "$pid"     # kill mother process first 
     154 
     155                        [ -f "${PIDFILE}_${pid}.pid" ] && { # if ssh was running, kill it also (mother process could be in retry wait) 
     156                                start-stop-daemon -K -p "${PIDFILE}_${pid}.pid" 
     157                                rm "${PIDFILE}_${pid}.pid" 
     158                        } 
     159                         
    155160                        logger -p daemon.info -t "sshtunnel[$pid]" "tunnel stopped" 
    156                         rm "$PIDFILE"_"$pid".pid 
    157                 done < "$PIDFILE".pids 
     161                         
     162                done < "${PIDFILE}.pids" 
    158163 
    159                 rm "$PIDFILE".pids 
     164                rm "${PIDFILE}.pids" 
    160165 
    161166                logger -p user.info -t "sshtunnel" "all tunnels stopped" 
     
    166171 
    167172start() { 
    168         [ -f "$PIDFILE".pids ] && stop 
     173        [ -f "${PIDFILE}.pids" ] && stop 
    169174         
    170175        config_load sshtunnel 
  • packages/net/sshtunnel/files/sshtunnel.sh

    r24691 r24807  
    1111        logger -p daemon.info -t "sshtunnel[$$][$server]" "connection started" 
    1212         
    13         start-stop-daemon -S -p "$PIDFILE"_"$$".pid -mx ssh -- $args &>/tmp/log/sshtunnel_$$  
     13        start-stop-daemon -S -p "${PIDFILE}_${$}.pid" -mx ssh -- $args &>/tmp/log/sshtunnel_$$  
    1414         
    1515        logger -p daemon.err -t "sshtunnel[$$][$server]" < /tmp/log/sshtunnel_$$ 
    1616        rm /tmp/log/sshtunnel_$$ 
    1717        logger -p daemon.info -t "sshtunnel[$$][$server]" "ssh exited with code $?, retrying in $retrydelay seconds" 
    18          
     18        rm "${PIDFILE}_${$}.pid" 
     19 
    1920        sleep "$retrydelay" & wait 
    2021done 
Note: See TracChangeset for help on using the changeset viewer.