update_model.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. #
  3. # nohup ./update_model.sh ithaca ecearth v3.0.1 setup >& update.log &
  4. # OR
  5. # nohup ./update_model.sh ithaca ecearth v3.0.1 inidata >& update.log &
  6. #
  7. set -xuve
  8. date
  9. src=/esnas/models
  10. plt=$1
  11. mod=$2
  12. ver=$3
  13. cat=$4
  14. ecchk=false # ecmwf check
  15. case $plt in
  16. ithaca) dst=/scratch/cfu/models ;;
  17. mn-*ecm86) dst=/gpfs/projects/ecm86/models ;;
  18. mn-*bsc32) dst=/gpfs/projects/bsc32/models ;;
  19. ecmwf-c2a) ecchk=true; dst=c2a:/perm/ms/spesiccf/c3m/models ;;
  20. ecmwf-cca) ecchk=true; dst=cca:/project/spesiccf/shared/models ;;
  21. ht-*) dst=/work/pr1u1011/pr1u1011/pr1e1001/models ;;
  22. lindgren) dst=/cfs/klemming/nobackup/a/asifsami/models ;;
  23. jaguar) dst= ;;
  24. ar-*) dst=/work/pr1u1011/pr1u1011/shared/models ;;
  25. esac
  26. if [[ $ecchk == false ]]; then
  27. rsync -acrv $src/$mod/$ver/$cat ${plt}:${dst}/$mod/$ver
  28. else
  29. cd $src/$mod/$ver
  30. dirs_list=$(find $cat/ -type d)
  31. for diR in $dirs_list; do
  32. set +e
  33. ecaccess-file-mkdir $dst/$mod/$ver/$diR
  34. set -e
  35. done
  36. list=/tmp/${mod}-${ver}-${cat}
  37. if [[ ! -a $list ]]; then
  38. find $cat/ -type f > $list
  39. fi
  40. for l in $(cat $list); do
  41. ecaccess-file-put $src/$mod/$ver/$l $dst/$mod/$ver/$l
  42. cat $list | sed -e '1d' > ${list}.tmp
  43. mv ${list}.tmp $list
  44. done
  45. cat $list; rm $list
  46. fi
  47. date