wrapperScript.sh 604 Bytes
Newer Older
1 2 3
#!/bin/bash


Nikos Marinos's avatar
Nikos Marinos committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#sleep 30

cmd="npx pubsweet server"

$cmd &

# Wait up to 3 minutes for server to respond, check every 20 seconds
COUNTER=0
while [ $COUNTER -lt 15 ]; do

   RUNNING=$(curl --silent --connect-timeout 20 "http://localhost:3000/" | grep "/assets/")
   if [ -n "$RUNNING" ] ; then
       echo "xPub is running"
       #echo "Creating the Users"
       #node scripts/adduser.js rakeshnambiar rakeshnbr@ebi.ac.uk Password_01 false
       ./post_init.sh
       exit 0
   fi
   echo "Waiting for xPub..."
   sleep 20
   let COUNTER=COUNTER+1
done

echo "ERROR: xPub is not running"

exit 1