Jpp  15.0.5
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JCookie.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 script=${0##*/}
6 
7 if [ -z $JPP_DIR ]; then
8  echo "Variable JPP_DIR undefined."
9  exit
10 fi
11 
12 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
13 
14 set_variable COOKIE `getCookie`
15 set_variable TIMEOUT_S 20
16 
17 if do_usage $*; then
18  usage "$script"\
19  "\nUtility script to check database cookie file."\
20  "\nIf needed, the user is prompted to create new cookie file."
21 fi
22 
23 # test cookie
24 
25 if [[ -f $COOKIE ]]; then
26 
27  JPrintDB -C $COOKIE -q detector >& /dev/null
28 
29  if (( $? != 0 )); then
30  echo "Remove broken cookie file $COOKIE";
31  rm -f $COOKIE
32  fi
33 fi
34 
35 if [[ ! -f $COOKIE ]]; then
36 
37  if [[ -z "$DBCOOKIE" ]]; then
38 
39  echo "Enter input within $TIMEOUT_S seconds."
40  echo -n "User name: "
41  read -t $TIMEOUT_S USR
42  if (( $? != 0 )); then
43  fatal "Timeout at user input."
44  fi
45  echo -n "Password: "
46  read -t $TIMEOUT_S -s PWD
47  echo
48  if (( $? != 0 )); then
49  fatal "Timeout at user input."
50  fi
51 
52  set_variable SERVER `JServerDB`
53 
54  wget --no-check-certificate \
55  "https://${SERVER}/home.htm?usr=${USR}&pwd=${PWD}&persist=y" \
56  -O $COOKIE && sed -i -- "s/sid=/.in2p3.fr\\tTRUE\\t\/\\tTRUE\\t0\\tsid\\t/g" $COOKIE
57 
58  if [[ ! -f $COOKIE ]]; then
59  fatal "No cookie $COOKIE"
60  fi
61  else
62 
63  echo "Using DBCOOKIE; unset to disable."
64  fi
65 fi
66 
67 JPrintDB -C $COOKIE -q detector >& /dev/null
68 
69 CHECK_EXIT_CODE
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter= ' ')
Read test summary.
then JMuonPostfit f
exit
Definition: JPizza.sh:36
then echo
static const double C
Physics constants.
const int n
Definition: JPolint.hh:660
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
* usage
then echo Remove broken cookie file $COOKIE
Definition: JCookie.sh:30
&set_variable SERVER
Definition: JStopDAQ.sh:29
esac timer_start JCookie sh set_variable COOKIE(cat~/.km3netdb_cookie) set_variable LOGIN $
Definition: JEditTuneHV.sh:78
do set_variable DETECTOR_TXT $WORKDIR detector
script
Definition: JAcoustics.sh:2
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null