Merge branch 'fulltree'
[electrum-server.git] / start
1 #!/bin/bash
2
3 electrum_config="/etc/electrum.conf"
4
5 if [ ! -f $electrum_config ]; then
6     echo "$electrum_config does not exist"
7     exit
8 fi
9
10 path=`grep path_fulltree $electrum_config |awk -F\= '{print $2}'`
11
12 #needs more hardening against double definiton of variable, dismiss commented ones
13
14 if ! [ "$path" ]; then
15     echo "Variable path_fulltree not set in $electrum_config"
16     exit
17     # we're actually forcing fulltree with this clause, which is ok if displaying v0.9 should use fulltree 
18 fi
19
20 if [ ! -d $path ]; then
21     echo "Database not found in $path."
22     read -p "Do you want to download it from the Electrum foundry to $path ? " -n 1 -r
23     echo
24     if [[ $REPLY =~ ^[Yy]$ ]]; then
25         wget -O - "http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar.gz" | tar -C $path --strip-components 1 -xvfz -
26     fi
27 fi
28
29 echo "starting server as daemon"
30 nohup /usr/bin/python -u server.py &> /var/log/electrum.log &