-
Notifications
You must be signed in to change notification settings - Fork 9
/
reindex.sh
executable file
·96 lines (89 loc) · 3.38 KB
/
reindex.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
source data
source keys
./c1 stop &>/dev/null
echo "Stopping the first daemon"
while ./c1 stop &>/dev/null
do
echo "waiting for the first daemon to stop"
sleep 5
done
./c2 stop &>/dev/null
echo "Stopping the second daemon"
while ./c2 stop &>/dev/null
do
echo "waiting for the second daemon to stop"
sleep 5
done
if [ $1 -eq 1 ] ; then
gnome-terminal -e "bash -c \"echo '$launch -pubkey=$pubkey1 -reindex'; $srcdir/$launch -pubkey=$pubkey1 -reindex\""
echo "started the first daemon in a new terminal with '-reindex' option"
gnome-terminal -e "bash -c \"echo 'tail -f ~/.komodo/$name/debug.log'; tail -f ~/.komodo/$name/debug.log\""
echo "opened debug.log in a new terminal"
echo "waiting for reindexing to finish"
tail -f /home/$USER/.komodo/$name/debug.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"Reindexing finished"* ]] && pkill -P $$ tail
done
sleep 3
echo "the daemon has finished reindexing; shutting down the daemon"
./c1 stop
while ./c1 stop &>/dev/null
do
echo "waiting for the first daemon to stop"
sleep 5
done
elif [ $1 -eq 2 ] ; then
gnome-terminal -e "bash -c \"echo '$launch -pubkey=$pubkey2 -reindex -datadir=$datadir/$name -addnode=localhost'; $srcdir/$launch -pubkey=$pubkey2 -reindex -datadir=$datadir/$name -addnode=localhost\""
echo "started the second daemon in a new terminal with '-reindex' option"
gnome-terminal -e "bash -c \"echo 'tail -f $datadir/$name/debug.log'; tail -f $datadir/$name/debug.log\""
echo "opened debug.log in a new terminal"
echo "waiting for reindexing to finish"
tail -f $datadir/$name/debug.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"Reindexing finished"* ]] && pkill -P $$ tail
done
sleep 3
echo "the daemon has finished reindexing; shutting down the daemon"
./c2 stop
while ./c2 stop &>/dev/null
do
echo "waiting for the second daemon to stop"
sleep 5
done
else
gnome-terminal -e "bash -c \"echo '$launch -pubkey=$pubkey1'; $srcdir/$launch -pubkey=$pubkey1\""
echo "started the first daemon in a new terminal with '-reindex' option"
gnome-terminal -e "bash -c \"echo 'tail -f ~/.komodo/$name/debug.log'; tail -f ~/.komodo/$name/debug.log\""
echo "opened debug.log in a new terminal"
echo "waiting for reindexing to finish"
tail -f /home/$USER/.komodo/$name/debug.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"Reindexing finished"* ]] && pkill -P $$ tail
done
sleep 3
echo "the daemon has finished reindexing; shutting down the daemon"
./c1 stop
while ./c1 stop &>/dev/null
do
echo "waiting for the first daemon to stop"
sleep 5
done
gnome-terminal -e "bash -c \"echo '$launch -pubkey=$pubkey2 -reindex -datadir=$datadir/$name -addnode=localhost'; $srcdir/$launch -pubkey=$pubkey2 -reindex -datadir=$datadir/$name -addnode=localhost\""
echo "started the second daemon in a new terminal with '-reindex' option"
gnome-terminal -e "bash -c \"echo 'tail -f $datadir/$name/debug.log'; tail -f $datadir/$name/debug.log\""
echo "opened debug.log in a new terminal"
echo "waiting for reindexing to finish"
tail -f $datadir/$name/debug.log | while read LOGLINE
do
[[ "${LOGLINE}" == *"Reindexing finished"* ]] && pkill -P $$ tail
done
sleep 3
echo "the daemon has finished reindexing; shutting down the daemon"
./c2 stop
while ./c2 stop &>/dev/null
do
echo "waiting for the second daemon to stop"
sleep 5
done
fi