SyncManunjaFromCdpp3.sh 1.31 KB
#!/bin/sh

# run at manunja
# MISSIONS_LIST example
# ACE
# GRD/AE

export DDBASE=/data/DDBASE/DATA
export remote=cdpp3.irap.omp.eu
export DDLIB=/home/budnik/AMDANEW/DDLIB/lib
export DECODERTOOLS=/home/budnik/depotDECODER/TOOLS

MISSIONS=${DDBASE}/../MISSIONS_LIST_CDPP3

if [ -f ${MISSIONS} ]; then
    while read Mission 
    do
        # if empty line - continue
        [ -z "$Mission" ] && continue

        for Dir in $(find -L $DDBASE/$Mission*  -maxdepth 4 -type d -links 2) 
        do 
   
            remoteDir="${Dir/data/data1}"
            sshpass -p "xxx" rsync -auvr budnik@${remote}:${remoteDir}/*nc.gz ${Dir}
            sshpass -p "xxx" rsync -vu  budnik@${remote}:${remoteDir}/*times.nc ${Dir}
            sshpass -p "xxx" rsync -vu  budnik@${remote}:${remoteDir}/*info* ${Dir}
        #    sshpass -p "xxx" rsync -vu budnik@${remote}:${remoteDir}/Vesrion ${Dir} 
        #    sshpass -p "xxx" rsync -vu budnik@${remote}:${remoteDir}/*Stop ${Dir}

            cd ${Dir}          
            ls | xargs chown -R budnik:dd ${Dir}
            ls | xargs chmod -R ug+w ${Dir} 
            ./clean
            cd ${DDBASE}/..
            
            php ${DECODERTOOLS}/DataBaseLog/updateDataBaseLog.php ${Dir} budnik fromCDPP3

         #   echo ${Dir} `date +"%Y-%m-%d"` >> sync.log
        done
    done <${MISSIONS}
 fi