Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
datalogs.sh
Go to the documentation of this file.
1#!/usr/bin/env zsh
2script=${0##*/}
3
4if [ -z $JPP_DIR ]; then
5 echo "Variable JPP_DIR undefined."
6 exit
7fi
8
9source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
10
11set_variable: DEBUG DATABASE_DEBUG 2
12set_variable: WORKDIR DATABASE_WORKDIR `pwd`
13
14if do_usage $*; then
15 usage "$script <detector identifier> <run>[-<run>] [source [parameter]]"
16fi
17
18case $# in
19 4) set_variable PARAMETER $4;&
20 3) set_variable SOURCE $3;&
21 2) set_variable RUNS $2;
22 set_variable DETID $1;;
23 *) fatal "Invalid number of arguments."
24esac
25
26set_variable DETID `getDetector -D $DETID -O string`
27set_variable FILENAME $WORKDIR/${DETID}_${RUNS}${SOURCE+.}${SOURCE}.log
28
29SELECTOR=(
30 "detid=$DETID"
31 "minrun=${RUNS%%-*}"
32 "maxrun=${RUNS##*-}")
33
34if [[ -n "$SOURCE" ]]; then; SELECTOR+="source_name=$SOURCE"; fi
35if [[ -n "$PARAMETER" ]]; then; SELECTOR+="parameter_name=$PARAMETER"; fi
36
37if [[ ! -f ${FILENAME}.gz ]]; then
38
39 wget \
40 --load-cookies=$HOME/.km3netdb_cookie \
41 --secure-protocol=TLSv1_2 \
42 "https://km3netdbweb.in2p3.fr/streamds/datalogstrings.txt?${(j:&:)SELECTOR}" \
43 -O ${FILENAME}
44
45 echo
46
47 if (( $? == 0 )) && [[ `head ${FILENAME}` != "ERROR: "* ]]; then
48 gzip -v ${FILENAME}
49 else
50 fatal "wget error"
51 fi
52fi