#! /bin/bash
#Copyright 1998-2022 Stonie R. Cooper, Licensed under the auspices of GPLv3,
# See top-level copyright disclaimer (COPYRIGHT) and license (LICENSE)
# NEXRAD script for pdinrs and metbox
if [ -f /tmp/NEXRAD ]
then
  boolean=`ps -elf | grep NEXRAD | grep -v grep | wc -l | awk -F" " '{print $1}'`
  if [ ${boolean} -gt 2 ]
  then
    exit
  fi
fi

touch /tmp/NEXRAD

for each_dir in `nice find /data/nexrad -mount -depth -type d`
do
   nice find ${each_dir} -type f -mount -mmin +2880 -exec rm -f {} \; > /dev/null 2>&1
done

rm -f /tmp/NEXRAD
