check pid before start
[electrum-server.git] / start
diff --git a/start b/start
index 9868ce1..6bf6668 100755 (executable)
--- a/start
+++ b/start
@@ -1,5 +1,12 @@
 #!/bin/bash
 
+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
@@ -22,9 +29,9 @@ if [ ! -d $path ]; then
     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" | tar -C $path --strip-components 1 -xvf -
+       wget -O - "http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar.gz" | tar -C $path --strip-components 1 -xvfz -
     fi
 fi
 
-echo "starting server as daemon"
+echo "Starting server as daemon"
 nohup /usr/bin/python -u server.py &> /var/log/electrum.log &