Fix reorg issues
[electrum-server.git] / start
diff --git a/start b/start
index 6bf6668..35624d1 100755 (executable)
--- a/start
+++ b/start
@@ -7,16 +7,14 @@ if [[ $PID != *[!0-9]* ]]; then
 fi
 
 
-electrum_config="/etc/electrum.conf"
+electrum_config="electrum.conf"
 
 if [ ! -f $electrum_config ]; then
     echo "$electrum_config does not exist"
     exit
 fi
 
-path=`grep path_fulltree $electrum_config |awk -F\= '{print $2}'`
-
-#needs more hardening against double definiton of variable, dismiss commented ones
+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"
@@ -24,14 +22,17 @@ if ! [ "$path" ]; then
     # we're actually forcing fulltree with this clause, which is ok if displaying v0.9 should use fulltree 
 fi
 
-if [ ! -d $path ]; then
-    echo "Database not found in $path."
-    read -p "Do you want to download it from the Electrum foundry to $path ? " -n 1 -r
-    echo
-    if [[ $REPLY =~ ^[Yy]$ ]]; then
-       wget -O - "http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar.gz" | tar -C $path --strip-components 1 -xvfz -
-    fi
-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 foundry to $path ? " -n 1 -r
+#    echo
+#    if [[ $REPLY =~ ^[Yy]$ ]]; then
+#      mkdir -p $path
+#      wget -O - "http://foundry.electrum.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 &> /var/log/electrum.log &
+nohup /usr/bin/python -u server.py &> electrum.log &