-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_combined_out_files.sh
executable file
·40 lines (37 loc) · 1.16 KB
/
make_combined_out_files.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# assume args are list of nights, check for proper formatting
ARGS="$@"
# set vars (maybe make command line opts later, or source from dagmaker.rc)
DESTCACHE="persistent"
SCHEMA="gw"
BASEDIR="/pnfs/des/${DESTCACHE}/${SCHEMA}/exp"
for nite in $ARGS
do
if [[ ! $nite =~ ^[0-9]{8}$ ]]; then
echo "improper format for night. Skipping"
continue
fi
exps=$(ls ${BASEDIR}/${nite})
for exp in $exps
do
fulldir=${BASEDIR}/${nite}/${exp}
if [ ! -s ${fulldir}/${exp}.out ]; then
nfiles=$(ls ${fulldir}/${exp}_*.out | wc -l)
if [ $nfiles -ge 60 ]; then
cat ${fulldir}/${exp}_1.out ${fulldir}/${exp}_{3..9}.out ${fulldir}/${exp}_{10..60}.out ${fulldir}/${exp}_62.out > ${fulldir}/${exp}.out || echo "Error running cat for ${exp}."
elif [ $nfiles -eq 0 ]; then
echo "No .out files present for $exp."
else
# echo "No combined.out file for ${exp} and one or more CCD .out files are missing; investigate."
missingccds=""
for ccd in 1 {3..9} {10..60} 62
do
if [ ! -s ${fulldir}/${exp}_${ccd}.out ]; then
missingccds="${missingccds} ${ccd}"
fi
done
echo "${exp} missing CCDs ${missingccds}."
fi
fi
done
done