abonec
3/10/2014 - 1:09 PM

Port forwarding for upstart via autossh and ssh

Port forwarding for upstart via autossh and ssh

description "autossh daemon" 
  
start on net-device-up IFACE=eth0  
stop on runlevel [01S6]  
  
respawn 
respawn limit 5 60 # respawn max 5 times in 60 seconds 
  
script 
    export AUTOSSH_PIDFILE=/var/run/autossh.pid 
    export AUTOSSH_POLL=60 
    export AUTOSSH_FIRST_POLL=30 
    export AUTOSSH_GATETIME=0 
    export AUTOSSH_DEBUG=1 
    autossh -M 0 -4 -N do -i /home/pi/.ssh/id_rsa -R 6001:localhost:9091 -R 6002:localhost:22 -R 6003:localhost:8030 -o "ServerAliveInterval 3" -o BatchMode=yes -o StrictHostKeyChecking=no 
end script