databaseUpdate.sh 850 Bytes
#!/bin/bash

# ENVIRONMENT VARIABLES
tgt=`echo $1`

. /home/budnik/depotDECODER/env.sh

if [ $tgt != "rosetta" ]
then
        tgtMaj=$(echo $tgt | tr [:lower:] [:upper:])
        . swenv.sh $tgtMaj
else
        . swenv.sh Rosetta
        tgt="p67"
fi


# UPDATE THE DATABASE (CLIENT SIDE)
echo  "UPDATE DATABASE"
cd $DDPATH && touch LOCK
ssh amda@apus.irap.omp.eu "cd $SW2ROOT/Data; mkdir temp; cp $tgt*/*.nc temp; cd temp; rename $tgt sw $tgt*"
#ssh amda@apus.irap.omp.eu "cd $SW2ROOT/Data; mkdir temp; cp */*.nc temp"
rsync -p amda@apus.irap.omp.eu:$REMOTEPATH/* $DDPATH/
cd $DDPATH && TimesUpdate -u sw_times.nc sw_[0-9]*.nc
php $DDBIN/UpdateInfo.php sw
cd $DDPATH && rm LOCK
cd $DDPATH && rm $tgt*.nc
php $DECODERTOOLS/DataBaseLog/updateDataBaseLog.php $DDPATH
#ssh amda@apus.irap.omp.eu "cd $SW2ROOT/Data; rm -rf temp; cd ../Missions; rm *.xml"