#! /bin/sh
#
# /etc/init.d/ script
#
# ssh tunnel to savely connect munin-nodes 
#
# Author:       tkilla
# v:            @(#)  09.2012

case "$1" in
  start)
        echo "Starting ssh tunnels..."

        echo "init tunnel :4950"
        ssh -L 4950:localhost:4949 -f -N -p22 -M -S /var/run/ssh_tunnel_xs.sock -o ExitOnForwardFailure=yes root@10.23.0.2
        ;;
  stop)
        echo "Stopping ssh tunnels..."

        ssh -S /var/run/ssh_tunnel_xs.sock -O exit root@10.23.0.2
        ;;
  restart)
    echo "stop"    
    $0 stop
    echo "start"
    $0 start
esac

exit 1
