#!/bin/bash

cmd="nc localhost 30002 | nc wiganradar.duckdns.org  41000"

while true; do
    check=`netstat -an | grep ".41000 \|:41000 "`

    if [ ${#check} -ge 10 ]
    then
	result="connected"
    else
	result="not connected"
	eval "${cmd}" &
    fi

    #echo $result

    sleep 60
done
