annotate save_logs.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
1 #!/usr/bin/env bash
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
2
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
3 WORKDIR=$1
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
4 LOGDIR=$2
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
5 INFO_FILE=$3
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
6
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
7 echo "===================================================================="
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
8 echo " Save logfiles from CESM run "
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
9 echo "===================================================================="
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
10
7a7ba86e95a4 "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
7a7ba86e95a4 "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)
7a7ba86e95a4 "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)
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
14
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
15 if [[ $nb -gt 0 ]]; then
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
16 if [[ $nb -gt 0 ]]; then
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
17 gunzip $1/${log_type}.log.*.gz
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
18 fi
7a7ba86e95a4 "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
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
20 fi
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
21 done
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
22
7a7ba86e95a4 "planemo upload for repository https://github.com/ESCOMP/CESM commit 5c969e494841237de0b2301520d9321672cc9f5b"
climate
parents:
diff changeset
23 echo "Logfiles saved."