#!/bin/bash # # nohup ./update_model.sh ithaca ecearth v3.0.1 setup >& update.log & # OR # nohup ./update_model.sh ithaca ecearth v3.0.1 inidata >& update.log & # set -xuve date src=/esnas/models plt=$1 mod=$2 ver=$3 cat=$4 ecchk=false # ecmwf check case $plt in ithaca) dst=/scratch/cfu/models ;; mn-*ecm86) dst=/gpfs/projects/ecm86/models ;; mn-*bsc32) dst=/gpfs/projects/bsc32/models ;; ecmwf-c2a) ecchk=true; dst=c2a:/perm/ms/spesiccf/c3m/models ;; ecmwf-cca) ecchk=true; dst=cca:/project/spesiccf/shared/models ;; ht-*) dst=/work/pr1u1011/pr1u1011/pr1e1001/models ;; lindgren) dst=/cfs/klemming/nobackup/a/asifsami/models ;; jaguar) dst= ;; ar-*) dst=/work/pr1u1011/pr1u1011/shared/models ;; esac if [[ $ecchk == false ]]; then rsync -acrv $src/$mod/$ver/$cat ${plt}:${dst}/$mod/$ver else cd $src/$mod/$ver dirs_list=$(find $cat/ -type d) for diR in $dirs_list; do set +e ecaccess-file-mkdir $dst/$mod/$ver/$diR set -e done list=/tmp/${mod}-${ver}-${cat} if [[ ! -a $list ]]; then find $cat/ -type f > $list fi for l in $(cat $list); do ecaccess-file-put $src/$mod/$ver/$l $dst/$mod/$ver/$l cat $list | sed -e '1d' > ${list}.tmp mv ${list}.tmp $list done cat $list; rm $list fi date