Jpp
 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 
16 if ( do_usage $* ); then
17  usage "$script"
18 fi
19 
20 # test cookie
21 
22 if [[ -f $COOKIE ]]; then
23 
24  JPrintDB -C $COOKIE -q detector >& /dev/null
25 
26  if (( $? != 0 )); then
27  echo "Remove broken cookie file $COOKIE";
28  rm -f $COOKIE
29  fi
30 fi
31 
32 if [[ ! -f $COOKIE ]]; then
33 
34  if [[ -z "$DBCOOKIE" ]]; then
35 
36  echo -n "User name: "
37  read USR
38  echo -n "Password: "
39  read -s PWD
40 
41  wget --no-check-certificate \
42  "https://km3netdbweb.in2p3.fr/home.htm?usr=${USR}&pwd=${PWD}&persist=y" \
43  -O $COOKIE && sed -i -- "s/sid=/.in2p3.fr\\tTRUE\\t\/\\tTRUE\\t0\\tsid\\t/g" $COOKIE
44 
45  if [[ ! -f $COOKIE ]]; then
46  fatal "No cookie $COOKIE"
47  fi
48  else
49 
50  echo "Using DBCOOKIE; unset to disable."
51  fi
52 fi
void set_variable(const std::string &name, const std::string &value)
Set environment variable.
bool read(Vec &v, std::istream &is)
Read a Vec(tor) from a stream.
Definition: io_ascii.hh:139
exit
Definition: JPizza.sh:36
then JPizza f
Definition: JPizza.sh:46
then echo
* usage
then echo Remove broken cookie file $COOKIE
Definition: JCookie.sh:27
alias put_queue eval echo n
Definition: qlib.csh:19
static const double C
Speed of light in vacuum [m/ns].
Definition: JConstants.hh:22
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null