diff save_restart.sh @ 0:7a7ba86e95a4 draft default tip

"planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
author climate
date Tue, 15 Jun 2021 09:39:23 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/save_restart.sh	Tue Jun 15 09:39:23 2021 +0000
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+WORKDIR=$1
+CASENAME=$2
+RESDIR=$3
+INFO_FILE=$4
+
+echo "===================================================================="
+echo "                Save restarts for CESM run                          " 
+echo "===================================================================="
+
+nb_nc=$(find $WORKDIR -type f -name "${CASENAME}.*.r*.*.nc" | wc -l)
+nb_bin=$(find $WORKDIR -type f -name "${CASENAME}.*.r*.*.bin" | wc -l)
+nb_i=$(find $WORKDIR -type f -name "${CASENAME}.*.i*.*.nc" | wc -l)
+nb_rp=$(find $WORKDIR -type f -name "rpointer.*" | wc -l)
+    
+if [[ $nb_nc -gt 0 ]]; then 
+    cp $WORKDIR/${CASENAME}.*.r*.*.nc $RESDIR/ 2>>$INFO_FILE
+fi
+if [[ $nb_bin -gt 0 ]]; then 
+    cp $WORKDIR/${CASENAME}.*.r*.*.bin $RESDIR/ 2>>$INFO_FILE
+fi
+if [[ $nb_i -gt 0 ]]; then 
+    cp $WORKDIR/${CASENAME}.*.i*.*.nc $RESDIR/ 2>>$INFO_FILE
+fi
+if [[ $nb_rp -gt 0 ]]; then 
+    cp $WORKDIR/rpointer.* $RESDIR/ 2>>$INFO_FILE
+fi
+echo "Restart saved."