Browse Source

update services chia et gebrera

Votre Nom 1 year ago
parent
commit
1798f451e2
2 changed files with 25 additions and 8 deletions
  1. 12 4
      options/build_gerbera.sh
  2. 13 4
      options/chia.sh

+ 12 - 4
options/build_gerbera.sh

@@ -115,23 +115,31 @@ function service_ {
 cd /home/wareck
 if [ -f gerbera.service ];then rm gerbera.service;fi
 cat <<'EOF'>> gerbera.service
-#!/bin/sh -e
+#!/bin/sh
 ### BEGIN INIT INFO
 # Provides:          gerbera
 # Required-Start:    networking
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Default-Start:     3 4 5
+# Default-Stop:      0 6
 ### END INIT INFO
 case "$1" in
-        start|restart)
+        start)
         if pgrep -x "gerbera" > /dev/null
         then
         sudo killall -9 gerbera | true
         fi
+        sleep 1
         su wareck -c "screen -dmS gerbera /usr/local/bin/gerbera -e enp5s0 -p 49152"
         ;;
         stop)
+        if pgrep -x "gerbera" > /dev/null
+        then
         sudo killall -9 gerbera | true
+        fi
+        ;;
+        restart)
+        $0 stop
+        $0 start
         ;;
         *)
         echo "Usage: /etc/init.d/gerbera.service {start|restart|stop}"

+ 13 - 4
options/chia.sh

@@ -260,15 +260,16 @@ echo -e "$(tput setaf 10)\nInstall chia-miner service (hpool) :$(tput sgr0)"
 sleep 1
 echo "Generation du fichier /etc/init.d/chia-miner"
 cat <<'EOF'>> chia-miner.sh
-#!/bin/sh -e
+#!/bin/sh
 ### BEGIN INIT INFO
 # Provides:          chiaminer
 # Required-Start:    networking
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Default-Start:     3 4 5
+# Default-Stop:      0 6
 ### END INIT INFO
 case "$1" in
-        start|restart)
+        start)
+        cd /home/wareck/miners/chia-miner/
         if pgrep -x "hpool-miner-chia" > /dev/null
         then
         sudo killall -9 hpool-miner-chia | true
@@ -276,13 +277,21 @@ case "$1" in
         su wareck -c "screen -dmS chia-miner /home/wareck/miners/chia-miner/hpool-miner-chia -config /home/wareck/miners/chia-miner/config.yaml"
         ;;
         stop)
+        if pgrep -x "hpool-miner-chia" > /dev/null
+        then
         sudo killall -9 hpool-miner-chia | true
+        fi
+        ;;
+        restart)
+        $0 stop
+        $0 start
         ;;
         *)
         echo "Usage: /etc/init.d/chia-miner {start|restart|stop}"
         exit 1
         ;;
 esac
+
 exit 0
 EOF
 chmod +x chia-miner.sh