-
Notifications
You must be signed in to change notification settings - Fork 0
/
start
executable file
·38 lines (29 loc) · 1.06 KB
/
start
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
#!/bin/bash
PID=`/usr/bin/python server.py getpid`
if [[ $PID != *[!0-9]* ]]; then
echo "Server already running (pid $PID)"
exit
fi
electrum_config="./electrum-vert.conf"
if [ ! -f $electrum_config ]; then
echo "$electrum_config does not exist"
exit
fi
path=`grep -e ^path_fulltree $electrum_config |awk -F\= '{print $2}' | tail -n 1`
if ! [ "$path" ]; then
echo "Variable path_fulltree not set in $electrum_config"
exit
# we're actually forcing fulltree with this clause, which is ok if displaying v0.9 should use fulltree
fi
rmdir $path --ignore-fail-on-non-empty
if [ ! -d $path ]; then
echo "Database not found in $path."
read -p "Do you want to download it from the Electrum-Vert db dumps to $path ? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
mkdir -p $path
wget -O - "http://electrum-vert.org/leveldb-dump/electrum-fulltree-100-latest.tar.gz" | tar --extract --gunzip --strip-components 1 --directory $path --file -
fi
fi
echo "Starting server as daemon"
nohup /usr/bin/python -u server.py &> ./electrum-vert.log &