update_nudging.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. #
  3. # nohup ./update_nudging.sh ithaca atmos T255L91 b0ir FALSE >& update.log &
  4. # nohup ./update_nudging.sh ithaca ocean glorys2v1 ORCA025L46 fc0 >& update.log &
  5. #
  6. set -xuve
  7. date
  8. src=/esnas/releases/nudging
  9. plt=$1
  10. typ=$2
  11. grd=$3
  12. ver=$4
  13. set +e; mem=$5; set -e
  14. case $plt in
  15. ithaca) dst=/share/data/cfu/nudging ;;
  16. mn-*) dst=/gpfs/projects/bsc32/repository/nudging ;;
  17. ecmwf) dst=ec:/c3m/nudging ;;
  18. ht-*) dst=/work/pr1u1011/pr1u1011/pr1e1001/nudging ;;
  19. lindgren) dst=/cfs/klemming/nobackup/a/asifsami/nudging ;;
  20. jaguar) dst= ;;
  21. ar-*) dst=/work/pr1u1011/pr1u1011/shared/nudging ;;
  22. esac
  23. case $typ in
  24. ocean)
  25. if [[ $plt != ecmwf ]]; then
  26. ssh $plt mkdir -p $dst/$typ/$grd/$ver/$mem
  27. rsync -acrv $src/$typ/$grd/$ver/$mem ${plt}:${dst}/$typ/$grd/$ver
  28. else
  29. set +e
  30. ecaccess-file-mkdir $dst
  31. ecaccess-file-mkdir $dst/$typ
  32. ecaccess-file-mkdir $dst/$typ/$grd
  33. ecaccess-file-mkdir $dst/$typ/$grd/$ver
  34. ecaccess-file-mkdir $dst/$typ/$grd/$ver/$mem
  35. set -e
  36. list=/tmp/${ver}-${grd}-${mem}
  37. if [[ ! -a $list ]]; then
  38. ls -1 $src/$typ/$grd/$ver/$mem > $list
  39. fi
  40. for l in $(cat $list); do
  41. ecaccess-file-put $src/$typ/$grd/$ver/$mem/$l $dst/$typ/$grd/$ver/$mem/$l
  42. cat $list | sed -e '1d' > ${list}.tmp
  43. mv ${list}.tmp $list
  44. done
  45. cat $list; rm $list
  46. fi
  47. ;;
  48. atmos)
  49. if [[ $plt != ecmwf ]]; then
  50. ssh $plt mkdir -p $dst/$typ/$grd
  51. rsync -acrv $src/$typ/$grd/$ver ${plt}:${dst}/$typ/$grd
  52. else
  53. set +e
  54. ecaccess-file-mkdir $dst/$typ
  55. ecaccess-file-mkdir $dst/$typ/$grd
  56. ecaccess-file-mkdir $dst/$typ/$grd/$ver
  57. set -e
  58. list=/tmp/${typ}-${grd}-${ver}
  59. if [[ ! -a $list ]]; then
  60. ls -1 $src/$typ/$grd/$ver > $list
  61. fi
  62. for l in $(cat $list); do
  63. ecaccess-file-put $src/$typ/$grd/$ver/$l $dst/$typ/$grd/$ver/$l
  64. cat $list | sed -e '1d' > ${list}.tmp
  65. mv ${list}.tmp $list
  66. done
  67. cat $list; rm $list
  68. fi
  69. ;;
  70. esac
  71. date