forked from bitpay/bitcore-wallet-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·37 lines (31 loc) · 902 Bytes
/
start.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
#!/bin/bash
mkdir -p logs
mkdir -p pids
# run_program (nodefile, pidfile, logfile)
run_program ()
{
nodefile=$1
pidfile=$2
logfile=$3
if [ -e "$pidfile" ]
then
echo "$nodefile is already running. Run 'npm stop' if you wish to restart."
return 0
fi
nohup node $nodefile >> $logfile 2>&1 &
PID=$!
if [ $? -eq 0 ]
then
echo "Successfully started $nodefile. PID=$PID. Logs are at $logfile"
echo $PID > $pidfile
return 0
else
echo "Could not start $nodefile - check logs at $logfile"
exit 1
fi
}
run_program locker/locker.js pids/locker.pid logs/locker.log
run_program messagebroker/messagebroker.js pids/messagebroker.pid logs/messagebroker.log
run_program bcmonitor/bcmonitor.js pids/bcmonitor.pid logs/bcmonitor.log
run_program emailservice/emailservice.js pids/emailservice.pid logs/emailservice.log
run_program bws.js pids/bws.pid logs/bws.log