Reverse ssh tunnel and snmpd + proxy

r00igev@@r

Honorary Master
Joined
Dec 14, 2009
Messages
15,639
Reaction score
14,157
Location
Draadloos Bantha poo doo in 4ways
I use a reverse ssh with:
/usr/bin/autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "PubkeyAuthentication=yes" -o "PasswordAuthentication=no" -i /home/amastelek/.ssh/id_rsa -R 42067:localhost:42067 -N -q user@ &
On the vpn server I have this in snmpd.conf:
proxy -Cn 157S -v 2c -c rcigmig2000 tcp:localhost:42067 .1.3

All works great but on a line outage I need to restart snmpd - ssh restarts automatically.

Any way to get snmpd to restart automatically?
 
Why not just do a cron with a script that ping check, if line drops do a loop ping check when a reply is received restart the service?

Something like this maybe/

Code:
((count = 100))                            # Maximum number to try.
while [[ $count -ne 0 ]] ; do
    ping -c 1 8.8.8.8                      # Try once.
    rc=$?
    if [[ $rc -eq 0 ]] ; then
        ((count = 1))                      # If okay, flag to exit loop.
    fi
    ((count = count - 1))                  # So we don't go forever.
done

if [[ $rc -eq 0 ]] ; then                  # Make final determination.
    echo `say The internet is back up.`
else
    echo `say Timeout.`
fi
 
Why not just do a cron with a script that ping check, if line drops do a loop ping check when a reply is received restart the service?

Something like this maybe/

Code:
((count = 100))                            # Maximum number to try.
while [[ $count -ne 0 ]] ; do
    ping -c 1 8.8.8.8                      # Try once.
    rc=$?
    if [[ $rc -eq 0 ]] ; then
        ((count = 1))                      # If okay, flag to exit loop.
    fi
    ((count = count - 1))                  # So we don't go forever.
done

if [[ $rc -eq 0 ]] ; then                  # Make final determination.
    echo `say The internet is back up.`
else
    echo `say Timeout.`
fi
In this case the local port to which the tunnel is mapped is timeout so maybe a script to check that via a chron will work. I'll give it a go.
 
Top
Sign up to the MyBroadband newsletter
X