7 if [ -z $JPP_DIR ]; then
 
    8     echo "Variable JPP_DIR undefined."
 
   12 source $JPP_DIR/setenv.sh $JPP_DIR >& /dev/null
 
   14 set_variable   COOKIE     `getCookie`  
 
   15 set_variable   TIMEOUT_S  20
 
   19           "\nUtility script to check database cookie file."\
 
   20           "\nIf needed, the user is prompted to create new cookie file."
 
   25 if [[ -f $COOKIE ]]; then
 
   27     JPrintDB -C $COOKIE -q detector >& /dev/null
 
   29     if (( $? != 0 )); then
 
   30         echo "Remove broken cookie file $COOKIE";
 
   35 if [[ ! -f $COOKIE ]]; then
 
   37     if [[ -z "$DBCOOKIE" ]]; then
 
   39         echo "Enter input within $TIMEOUT_S seconds."
 
   41         read -t $TIMEOUT_S    USR
 
   42         if (( $? != 0 )); then
 
   43             fatal "Timeout at user input."
 
   46         read -t $TIMEOUT_S -s PWD
 
   48         if (( $? != 0 )); then
 
   49             fatal "Timeout at user input."
 
   52         set_variable SERVER `JServerDB`
 
   54         wget --no-check-certificate -q \
 
   55             "https://${SERVER}/home.htm?usr=${USR}&pwd=${PWD}&persist=y&freenetbits=16" \
 
   56             -O $COOKIE && sed -i -- "s/sid=/.in2p3.fr\\tTRUE\\t\/\\tTRUE\\t0\\tsid\\t/g" $COOKIE
 
   58         if [[ ! -f $COOKIE ]]; then
 
   59             fatal "No cookie $COOKIE"
 
   63         echo "Using DBCOOKIE; unset to disable."
 
   67 JPrintDB -C $COOKIE -q detector >& /dev/null