#!/usr/bin/env bash
# lrauv-data-file-audit.sh
#
# This script walks the missionlogs directories and reports any missing
# .nc4 files and checks whether derived 'sci', 'eng', or 'scieng' files
# need to be produced.
# To monitor progress and/or debug, use `tail` on the log file,
# e.g., :
#
#     [tethysadmin@tethysdata ~]$ tail -f /tmp/lrauv-data-file-audit.tethys.log
#

# add Python3.5 to path
export PATH=$PATH:/opt/rh/python35/root/usr/bin

LOGDIR=/tmp
DATA_ROOT=/mbari/LRAUV

PYTHON=/home/tethysadmin/lrauv-tools/handle-lrauv-logs/lrauv-data-file-audit/lrauv-data-file-audit.py
# Use above for production, use below for development
##PYTHON=lrauv-data-file-audit/lrauv-data-file-audit.py
PYTHON_OPT="--verbose --path ${DATA_ROOT} --vehicle"

for vehicle in tethys daphne makai ahi aku opah whoidhs galene brizo pontus triton
do
  log=${LOGDIR}/lrauv-data-file-audit.${vehicle}.log
  pcmd="${PYTHON} ${PYTHON_OPT} ${vehicle} > ${log}"
  echo "*** running ${pcmd}"
  eval ${pcmd}
done

