Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.92 KB | None | 0 0
  1. #!/bin/bash
  2. while :
  3. do
  4.     wget -q --tries=10 --timeout=20 --spider http://google.com
  5.     if [[ $? -eq 0 ]]; then
  6.         echo "Online"
  7.            
  8.         if [[ "$(pidof python3.7)" == "" ]]; then
  9.             echo "bots arent running";
  10.             python3.7 -u /home/pi/TchernobogBOT/main.py &> /home/pi/logs/technoborg &
  11.             python3.7 -u /home/pi/TchernobogNetworkBOT/main.py &> /home/pi/logs/network &
  12.             python3.7 -u /home/pi/DiscordpotatoBot/main.py &> /home/pi/logs/potato &
  13.             python3.7 -u /home/pi/ArcfallBOT/main.py &> /home/pi/logs/arcfall &
  14.             python3.7 -u /home/pi/ArcfallLootBOT/main.py &> /home/pi/logs/arcfallLoot &
  15.             python3.7 -u /home/pi/StreamBOT/main.py &> /home/pi/logs/stream &
  16.             python3.7 -u /home/pi/MLORPGBOT/main.py &> /home/pi/logs/MLORPG &
  17.             python3.7 -u /home/pi/LOOBOT/main.py &> /home/pi/logs/LOOBOT &
  18.             python3.7 -u /home/pi/FUGATSUBOT/main.py &> /home/pi/logs/FUGATSU &
  19.             python3.7 -u /home/pi/PROFLIGACYBOT/main.py &> /home/pi/logs/PROFLIGACY &
  20.            
  21.         else
  22.             if [[ "$(pidof python3.7 | wc -w)" < 10 ]]; then
  23.                 FILE=/home/pi/update
  24.                 if test -f "$FILE"; then
  25.                     if [[ "$(less /home/pi/update)" == "network" ]]; then
  26.                         python3.7 -u /home/pi/TchernobogNetworkBOT/main.py &> /home/pi/logs/network &
  27.                     elif [[ "$(less /home/pi/update)" == "technoborg" ]]; then
  28.                         python3.7 -u /home/pi/TchernobogBOT/main.py &> /home/pi/logs/technoborg &
  29.                     elif [[ "$(less /home/pi/update)" == "potato" ]]; then
  30.                         python3.7 -u /home/pi/DiscordpotatoBot/main.py &> /home/pi/logs/potato &
  31.                     elif [[ "$(less /home/pi/update)" == "arcfall" ]]; then
  32.                         python3.7 -u /home/pi/ArcfallBOT/main.py &> /home/pi/logs/arcfall &
  33.                     elif [[ "$(less /home/pi/update)" == "arcfallLoot" ]]; then
  34.                         python3.7 -u /home/pi/ArcfallLootBOT/main.py &> /home/pi/logs/arcfallLoot &
  35.                     elif [[ "$(less /home/pi/update)" == "stream" ]]; then
  36.                         python3.7 -u /home/pi/StreamBOT/main.py &> /home/pi/logs/stream &
  37.                     elif [[ "$(less /home/pi/update)" == "MLORPG" ]]; then
  38.                         python3.7 -u /home/pi/MLORPG/main.py &> /home/pi/logs/MLORPG &
  39.                     elif [[ "$(less /home/pi/update)" == "LOOBOT" ]]; then
  40.                         python3.7 -u /home/pi/LOOBOT/main.py &> /home/pi/logs/LOOBOT &
  41.                     elif [[ "$(less /home/pi/update)" == "FUGATSU" ]]; then
  42.                         python3.7 -u /home/pi/FUGATSUBOT/main.py &> /home/pi/logs/FUGATSU &
  43.                     elif [[ "$(less /home/pi/update)" == "PROFLIGACY" ]]; then
  44.                         python3.7 -u /home/pi/PROFLIGACYBOT/main.py &> /home/pi/logs/PROFLIGACY &
  45.                     else
  46.                         echo "Update unknown"
  47.                     fi
  48.                     rm /home/pi/update
  49.                 else
  50.                     for pid in $(pidof python3.7); do sudo kill -9 $pid; done
  51.                     cp -r /home/pi/logs/. /home/pi/logs2/
  52.                    
  53.                 fi
  54.             fi 
  55.         fi     
  56.         if [[ "$(pidof pinger)" == "" ]]; then
  57.             /home/pi/TchernobogNetworkBOT/pinger &> /home/pi/logs/pingerlog &
  58.         fi
  59.     else
  60.         echo "Offline"
  61.         for pid in $(pidof python3.7); do sudo kill -9 $pid; done
  62.         for pid in $(pidof pinger); do sudo kill -9 $pid; done
  63.     fi
  64.     sleep 30
  65. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement