#!/bin/sh /usr/local/bin/natpmpc -a 1 0 udp 60 -g 10.2.0.1 | grep "Mapped public port" | awk '{print $4}' | tee /usr/local/etc/natvpn_port.txt while true; do date if ! /usr/local/bin/natpmpc -a 1 0 udp 60 -g 10.2.0.1 && /usr/local/bin/natpmpc -a 1 0 tcp 60 -g 10.2.0.1; then echo "error Failure natpmpc $(date)" break fi sleep 45 done