Jpp  18.2.1-ARCA-DF-PATCH
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
getArchive.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 script=${0##*/}
6 
7 source ${0%${script}}ulib.sh
8 
9 set_variable: DEBUG ARCHIVE_DEBUG 2
11 
12 if do_usage $*; then
13  usage "$script <path> [<detector identifier> [<run> [<type> [version]]]]"\
14  "\nUtility script to list files in archive."
15 fi
16 
17 case $# in
19  4) set_variable TYPE $argv[4];&
20  3) let RUN=" $argv[3]";&
21  2) let ID=" $argv[2]";&
23  *) fatal "Wrong number of arguments."
24 esac
25 
26 
27 if [[ ! -d $DIR ]]; then
28  fatal "Invalid path $argv[1]"
29 fi
30 
31 
32 setopt extendedglob
33 
34 typeset -Z8 ID
35 
36 
37 #
38 # print file properties
39 #
40 # \param 1 file name
41 #
42 function archive()
43 {
44  typeset -T BUFFER ARRAY /
45 
46  BUFFER=$1
47 
48  set_variable A_ID ${ARRAY[-6]}
49  set_variable A_TYPE ${ARRAY[-5]}
50  set_variable A_VERSION ${ARRAY[-4]#_}
51  let A_MINRUN=" ${ARRAY[-3]}"
52  let A_MAXRUN=" ${ARRAY[-2]}"
53  set_variable A_FILENAME ${ARRAY[-1]}
54 
55  let A_COUNTER="${A_FILENAME:r}"
56 
57  if (( $RUN >= $A_MINRUN && $RUN <= $A_MAXRUN )); then
58 
59  ls -l --author $BUFFER
60 
61  if (( $DEBUG >= 3 )); then
62  echo "identifier: $(($A_ID))"
63  echo "type: $A_TYPE"
64  echo "version: $A_VERSION"
65  echo "minimal run: $(($A_MINRUN))"
66  echo "maximal run: $(($A_MAXRUN))"
67  echo
68  fi
69  fi
70 
71 }
72 
73 
74 if (( $# == 1 )); then
75  ls -1 $DIR/ | egrep ${ANY}; return
76 fi
77 
78 
79 if (( $ID == 0 )); then
80  fatal "Invalid detector identifier $argv[2]"
81 fi
82 
83 
84 if (( $# == 2 )); then
85  ls -1 $DIR/$ID/; return
86 fi
87 
88 
89 if (( $RUN == 0 )); then
90  fatal "Invalid run $argv[3]"
91 fi
92 
93 
94 if (( $# == 3 )); then
95 
96  eval ls -1 $DIR/$ID/\*/_\*/\*/\*/\* 2> /dev/null | while read BUFFER; do
97  archive $BUFFER
98  done
99 fi
100 
101 
102 if (( $# >= 4 )); then
103 
104  eval ls -1 $DIR/$ID/$TYPE/_${VERSION}/\*/\*/\* 2> /dev/null | while read BUFFER; do
105  archive $BUFFER
106  done
107 fi
then usage $script< detector identifier >< startdate\"YYYY-MM-DDHH:MM:SS\"><finaldate\"YYYY-MM-DDHH:MM:SS\"><QA/QCfile> fi case set_variable QAQC_TXT $argv[4]
Definition: JDataMonitor.sh:24
then ls $DIR egrep
Definition: getArchive.sh:75
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
esac done BUFFER
Definition: JMakePDF.sh:83
then
Definition: datalogs.sh:31
then fatal Wrong number of arguments fi DIR
do set_variable A_ID
Definition: getFile.sh:53
then fatal Invalid path $argv[1] fi setopt extendedglob typeset Z8 ID function archive()
Definition: getArchive.sh:42
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:21
do set_variable OUTPUT_DIRECTORY $WORKDIR T
then rm i $OUTPUT_FILE fi let RUN
#define VERSION
Definition: elog-version.h:27
* usage
then ls $DIR $ID
Definition: getArchive.sh:85
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then eval ls $DIR $ID $TYPE _
Definition: getArchive.sh:104
then echo
Definition: JQAQC.sh:90
static JNullStream null
Null I/O stream.
Definition: JNullStream.hh:51
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
script
Definition: JAcoustics.sh:2
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62