#!/bin/sh self=`basename $0` : ${wait:=1h} : ${delay:=60} #secs between pings auv=$1 case $auv in '') cat <&2 Update logs from ESP riding on AUV when specified AUV is available on network Delays $wait between successful updates Additional optional args are passed directly into upsync Example: $self lrauv-makai-cell #upload from makai on cellular link Note: This script never exits EOS exit 2 esac shift echo >&2 echo -n "`date` -- Pinging $auv ... " >&2 while :; do ping -qc 1 -W $delay $auv >/dev/null ret=$? if [ $ret = 0 ]; then echo >&2 echo "`date` -- upsync $*" ssh $auv onESP upsync "$@" || { sleep $delay continue } echo -n "`date` -- Waiting $wait ... " >&2 sleep $wait echo >&2 echo -n "`date` -- Pinging $auv ... " >&2 elif [ $ret -gt 1 ]; then exit $ret fi done