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

3
echo "Running server in the background"
4
cmd="pm2 start pm2.pubsweet.config.js"
Nikos Marinos's avatar
Nikos Marinos committed
5 6 7

$cmd &

8 9 10
echo "Wait up to 3 minutes for server to respond, check every 20 seconds"
COUNTER=0
while [ $COUNTER -lt 15 ]; do
11

12
   RUNNING=$(curl --silent --connect-timeout 20 "http://localhost:$PORT" | grep "/assets/")
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   if [ -n "$RUNNING" ] ; then
       echo "xPub is running"
       #echo "Creating the Users"
       #node scripts/adduser.js rakeshnambiar rakeshnbr@ebi.ac.uk Password_01 false
       echo "Running post_init.sh script"
       ./post_init.sh
       
       tail -f /dev/null
   fi
   echo "Waiting for xPub..."
   sleep 20
   let COUNTER=COUNTER+1
done

echo "ERROR: xPub is not running"
Nikos Marinos's avatar
Nikos Marinos committed
28

29
tail -f /dev/null