-
Notifications
You must be signed in to change notification settings - Fork 2
/
start-endpoint-example.sh
executable file
·44 lines (44 loc) · 1.12 KB
/
start-endpoint-example.sh
1
2
3
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
36
37
38
39
40
41
42
43
44
#!/bin/bash
#export HOME=/home/scoopadmin
source $HOME/.bash_profile
source $HOME/.bashrc
export ENDPOINT=$HOME/git/scoophealth/hquery/query-gateway
export GW_PIDFILE=$ENDPOINT/tmp/pids/server.pid
export DL_PIDFILE=$ENDPOINT/tmp/pids/delayed_job.pid
#
# Make sure mongod is running
if ! pgrep mongod > /dev/null
then
sudo service mongod start
fi
#
#echo "Starting relay service on port 3000"
#$ENDPOINT/util/relay-service.rb >> $HOME/logs/rs.log 2>&1 &
#
echo "Starting Query Gateway on port 3001"
cd $ENDPOINT
# Stop delayed_job if running, remove pidfile
if [ -f $DL_PIDFILE ];
then
bundle exec $ENDPOINT/script/delayed_job stop
if [ -f $DL_PIDFILE ];
then
rm $DL_PIDFILE
fi
fi
#
bundle exec $ENDPOINT/script/delayed_job start
#
# Start gateway
# If gateway is already running (or has a stale server.pid), try to stop it.
if [ -f $GW_PIDFILE ];
then
kill `cat $GW_PIDFILE`
if [ -f $GW_PIDFILE ];
then
kill -9 `cat $GW_PIDFILE`
fi
rm $GW_PIDFILE
fi
bundle exec rails server -p 3001 >> $ENDPOINT/log/qgw.log 2>&1 &
#/bin/ps -ef | grep "rails server -p 3001" | grep -v grep | awk '{print $2}' > tmp/pids/server.pid