-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathservice.sh
executable file
·53 lines (45 loc) · 1.78 KB
/
service.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
45
46
47
48
49
50
51
52
53
#!/bin/bash
# Our coins to run
COINS="litecoin"
# Change this to your checkouts folder if you wish to run the script outside the WORKDIR
WORKDIR=$PWD
cd $WORKDIR
case $1 in
'start')
for coin in $COINS; do
echo -n "Starting ${coin}d ... "
ps ax | grep -q "${coin}d -datadir=testnet/$coin -[d]aemon" && echo " Already running" || {
coins/${coin}/src/${coin}d -datadir=testnet/$coin -daemon &>/dev/null && echo OK || echo FAIL
}
done
echo -n "Waiting for coind"
for i in 1 2 3 4 5 6 7 8 9 10; do
echo -n .
sleep 1
done
echo ""
echo -n "Starting litecoin stratum ... "
LTCADDRESS=$(coins/litecoin/src/litecoind -datadir=testnet/litecoin getaccountaddress "")
echo -n "WALLET=${LTCADDRESS} "
sed -i -e "s/^CENTRAL_WALLET.*/CENTRAL_WALLET = '$LTCADDRESS'/" mining/stratum-mining/conf/config.py
cd mining/stratum-mining
/opt/local/bin/twistd-2.7 -y launcher.tac &>/dev/null && echo OK || echo FAIL
cd ../../
;;
'stop')
for coin in $COINS; do
echo -n "Stopping ${coin}d ... "
coins/${coin}/src/${coin}d -datadir=testnet/$coin stop &>/dev/null && echo OK || echo FAIL
done
echo -n "Stopping stratums ... "
TWISTPID=$(cat mining/stratum-mining/twistd.pid 2>/dev/null)
[[ ! -z $TWISTPID ]] && kill $TWISTPID && echo OK || echo " no PID"
;;
'clean')
$0 stop
for coin in $COINS; do
rm -fR testnet/${coin}/testnet3/wallet.dat
done
/opt/local/bin/mysql5 -h localhost -u root -proot mpos -e "truncate shares; truncate blocks; truncate shares_archive; truncate statistics_shares; truncate transactions; update settings set value = 0 where name = 'pps_last_share_id'; update settings set value = 0 where name = 'last_accounted_block_id'; truncate notifications;"
;;
esac