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

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

$cmd &

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

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

echo "ERROR: xPub is not running"

28
exit 1