X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=blobdiff_plain;f=start;h=e0d0bc987313291e1aa4016d1ff845d671e45587;hp=36c01eaa77d4c658efc5f4878f9dcfb9b7c82078;hb=57e177fc275a816b6eca588cf98cb65ab46a475a;hpb=9512e38a375111d6ecbdc720c16cbc053017cdfc diff --git a/start b/start index 36c01ea..e0d0bc9 100755 --- a/start +++ b/start @@ -1,19 +1,38 @@ #!/bin/bash -path=`grep path_fulltree /etc/electrum.conf |awk -F\= '{print $2}'` +PID=`/usr/bin/python server.py getpid` +if [[ $PID != *[!0-9]* ]]; then + echo "Server already running (pid $PID)" + exit +fi + + +electrum_config="/etc/electrum.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 foundry? " -n 1 -r + read -p "Do you want to download it from the Electrum foundry to $path ? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - rm -rf fulltree fulltree.tar - wget http://ecdsa.net/fulltree.tar - tar -xvf fulltree.tar - mv fulltree $path - rm -rf fulltree fulltree.tar + 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" +echo "Starting server as daemon" nohup /usr/bin/python -u server.py &> /var/log/electrum.log &