Script to wget new files into our ground nav archive.

#!/usr/bin/bash
#

JAVAD_ID=( "j525" "j426" )
JAVAD_IP=( "192.168.0.25" "192.168.0.26" )
JAVAD_PASS=( "J525BASE" "J426BASE" )

DEST_DIR="/mnt/archive/gndnav"

for key in "${!JAVAD_IP[@]}"
do  # ping receiver, if it responds attempt the wget mirror
   ping "${JAVAD_IP[$key]}" -c 1 -q > /dev/null 2>&1
   if [[ $? -eq 0 ]] ; then
      wget --directory-prefix="${DEST_DIR}/${JAVAD_ID[$key]}" \
         --mirror \
         --no-host-directories \
         --no-passive-ftp \
         --password="${JAVAD_PASS[$key]}" \
         --recursive \
         --level=1 \
         --timeout=1 \
         --tries=1 \
         --user=ftp \
         ftp://"${JAVAD_IP[$key]}"/
   fi
done

# example command lines
# wget -m ftp://192.168.0.25/ --user=ftp --password=J525BASE
# wget -m ftp://192.168.0.26/ --user=ftp --password=J526BASE