Votre Nom 1 year ago
parent
commit
61dd25763d
1 changed files with 7 additions and 6 deletions
  1. 7 6
      options/chia.sh

+ 7 - 6
options/chia.sh

@@ -264,21 +264,22 @@ cat <<'EOF'>> chia-miner.sh
 ### BEGIN INIT INFO
 ### BEGIN INIT INFO
 # Provides:          chiaminer
 # Provides:          chiaminer
 # Required-Start:    networking
 # Required-Start:    networking
-# Default-Start:     3 4 5
-# Default-Stop:      0 6
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
 ### END INIT INFO
 ### END INIT INFO
 case "$1" in
 case "$1" in
         start|restart)
         start|restart)
-        cd /home/wareck/miners/chia-miner/
-	sudo killall -9 hpool-miner-chia > /dev/null 2>&1
-	sleep 1
+        if pgrep -x "hpool-miner-chia" > /dev/null
+        then
+        sudo killall -9 hpool-miner-chia | true
+        fi
         su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
         su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
         ;;
         ;;
         stop)
         stop)
         sudo killall -9 hpool-miner-chia | true
         sudo killall -9 hpool-miner-chia | true
         ;;
         ;;
         *)
         *)
-        echo "Usage: /etc/init.d/chia-miner {start|stop|restart}"
+        echo "Usage: /etc/init.d/chia-miner {start|restart|stop}"
         exit 1
         exit 1
         ;;
         ;;
 esac
 esac