annotate save_logs.sh @ 0:ae3b4cdf4a3a draft default tip

"planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
author climate
date Tue, 15 Jun 2021 09:38:51 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
1 #!/usr/bin/env bash
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
2
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
3 WORKDIR=$1
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
4 LOGDIR=$2
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
5 INFO_FILE=$3
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
6
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
7 echo "===================================================================="
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
8 echo " Save logfiles from CESM run "
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
9 echo "===================================================================="
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
10
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
11 for log_type in atm cesm cpl lnd rof; do
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
12 nb=$(find $WORKDIR -type f -name "$log_type.log.*" | wc -l)
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
13 nbz=$(find $WORKDIR -type f -name "$log_type.log.*.gz" | wc -l)
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
14
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
15 if [[ $nb -gt 0 ]]; then
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
16 if [[ $nb -gt 0 ]]; then
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
17 gunzip $1/${log_type}.log.*.gz
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
18 fi
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
19 cat $1/${log_type}.* > $2/${log_type}_log.txt 2>>$INFO_FILE
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
20 fi
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
21 done
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
22
ae3b4cdf4a3a "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
23 echo "Logfiles saved."