#!/bin/bash
#
# Script that starts copy daemons - Water Vapor version
#
#################################

. $HOME/.compositerc-wv

#start_daemons
LOGFILE=$ACQUIRE_ADMIN/daemon_restart-wv.log
exec >>$LOGFILE
exec 2>>$LOGFILE


cd $SATINFO

ls -1 *.info 2>/dev/null|while read infofile; do
   #check if proc is already running
   count=$(ps -ef|grep "copy_wv2_image_data.bash $infofile"|grep -v grep|wc -l)
   if [[ $count -eq 0 ]]; then
      cd $ACQUIRE_BIN
      echo Starting Copy daemon for $infofile $(date -u)
      ($ACQUIRE_BIN/copy_wv2_image_data.bash $infofile &)
   fi
done

exit 0
