@@ -20,6 +20,7 @@ function bootstrap_node() {
20
20
local download_dir=/kingofthenorth/bootstrap-seed/
21
21
local extraction_dir=/kingofthenorth/raven-dir/
22
22
local transmission_dir=~ /.config/transmission-daemon/
23
+ local bootstrap_done=" bootstrap.done"
23
24
while [ ! " $( transmission-remote localhost -n transmission:transmission -l | grep " rvn-bootstrap*.tar.gz" | awk ' {print $5}' ) " = " Done" ];
24
25
do
25
26
echo -e " $( date) - Waiting for bootstrap file to finish downloading..." > ~ /bootstrap-status.log
@@ -33,18 +34,26 @@ function bootstrap_node() {
33
34
return 1
34
35
fi
35
36
37
+ echo -e " $( date) - Verifying the bootstrap file integrity..." > ~ /bootstrap-status.log
36
38
cp ${transmission_dir} /seeding/rvn-bootstrap.md5 ${download_dir}
37
- pushd $download_dir
39
+ pushd $download_dir & > /dev/null
38
40
if ! md5sum -c rvn-bootstrap.md5 --status --ignore-missing; then
39
41
echo -e " $( date) - ERROR: Failed to verify the MD5 checksum of the downloaded bootstrap file!" > ~ /bootstrap-status.log
42
+ popd & > /dev/null
40
43
return 1
41
44
fi
42
- popd
45
+ popd & > /dev/null
46
+
47
+ if [ -f " ${download_dir} /${bootstrap_done} " ]; then
48
+ echo -e " $( date) - Extraction skipped since file already exists..." > ~ /bootstrap-status.log
49
+ return 0
50
+ fi
43
51
44
52
echo -e " $( date) - Extracting the bootstrap file database..." > ~ /bootstrap-status.log
45
53
extract_file $bootstrap_file $extraction_dir || { echo -e " Failed to extract the bootstrap database..." > ~ /bootstrap-status.log && return 1; }
46
54
47
55
echo -e " $( date) - Extraction of the bootstrap file completed succesfully!" > ~ /bootstrap-status.log
56
+ touch $bootstrap_done $download_dir
48
57
return 0
49
58
}
50
59
@@ -84,13 +93,22 @@ function install_rvn() {
84
93
}
85
94
86
95
function node_status() {
87
- local bootstrap_file=" /home/kingofthenorth/bootstrap-status.log"
96
+ local home_dir=" /home/kingofthenorth"
97
+ local bootstrap_file=" ${home_dir} /bootstrap-status.log"
88
98
if [ -f $bootstrap_file ]; then
89
99
cat $bootstrap_file
90
100
fi
91
101
local ravend_pid=$( ps aux | grep ravend | grep -v grep)
92
102
if [ -n " ${ravend_pid} " ]; then
93
- raven_status
103
+ local status_file=" node_status.log"
104
+ local curr_t=$( date +%s)
105
+ local status_file_t=$( date -r ${status_file} +%s)
106
+ local diff_t=$[$curr_t - $status_file_t ]
107
+ if [ $diff_t -gt 60 ]; then
108
+ raven_status > $status_file
109
+ else
110
+ cat $status_file
111
+ fi
94
112
fi
95
113
return 0
96
114
}
@@ -129,7 +147,13 @@ function init() {
129
147
# Start bootstraping the node
130
148
bootstrap_node || { sleep 600 && return 2; }
131
149
# Start ravencoin daemon
132
- ravend || return 3
150
+ local ravend_done=" ravend-reindex.done"
151
+ if [ -f " ${ravend_done} " ]; then
152
+ ravend || return 3
153
+ else
154
+ touch $ravend_done
155
+ ravend -reindex || return 4
156
+ fi
133
157
}
134
158
135
159
$1
0 commit comments