/
start-local.sh
executable file
·42 lines (34 loc) · 854 Bytes
/
start-local.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
#!/bin/bash
LOGS="$HOME/logs"
if [ ! -d "$LOGS" ]; then
echo "please create a logs directory in ~/logs"
exit 1
fi
if [ `pwd | sed s/.*src//` != "/github.com/lacker/coinkit" ]; then
echo "please run this from the coinkit directory"
exit 1
fi
RUNNING=`pgrep ^cserver`
if [ -n "$RUNNING" ]
then
echo "there are already cservers running:"
ps aux | grep [^a-z]cserver | grep -v grep
exit 1
fi
echo rebuilding binaries...
go install ./...
if [ $? -ne 0 ]
then
echo "not starting cservers due to error"
exit 1
fi
for i in `seq 0 3`;
do
ARGS="--database=./local/database$i.json"
ARGS="$ARGS --keypair=./local/keypair$i.json"
ARGS="$ARGS --network=./local/network.json"
ARGS="$ARGS --http=800$i"
nohup cserver $ARGS &> $LOGS/cserver$i.log &
done
sleep 0.1
ps aux | grep [^a-z]cserver | grep -v grep