Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.05 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 (( $(pgrep -c python3.7) < 10 )); then
  23.                 echo "less than 10 bots detected!"
  24.                 FILE=/home/pi/update
  25.                 if test -f "$FILE"; then
  26.                     if [[ "$(less /home/pi/update)" == "network" ]]; then
  27.                         python3.7 -u /home/pi/TchernobogNetworkBOT/main.py &> /home/pi/logs/network &
  28.                     elif [[ "$(less /home/pi/update)" == "technoborg" ]]; then
  29.                         python3.7 -u /home/pi/TchernobogBOT/main.py &> /home/pi/logs/technoborg &
  30.                     elif [[ "$(less /home/pi/update)" == "Potato" ]]; then
  31.                         python3.7 -u /home/pi/DiscordPotatoBot/main.py &> /home/pi/logs/Potato &
  32.                     elif [[ "$(less /home/pi/update)" == "arcfall" ]]; then
  33.                         python3.7 -u /home/pi/ArcfallBOT/main.py &> /home/pi/logs/arcfall &
  34.                     elif [[ "$(less /home/pi/update)" == "arcfallLoot" ]]; then
  35.                         python3.7 -u /home/pi/ArcfallLootBOT/main.py &> /home/pi/logs/arcfallLoot &
  36.                     elif [[ "$(less /home/pi/update)" == "stream" ]]; then
  37.                         python3.7 -u /home/pi/StreamBOT/main.py &> /home/pi/logs/stream &
  38.                     elif [[ "$(less /home/pi/update)" == "MLORPG" ]]; then
  39.                         python3.7 -u /home/pi/MLORPG/main.py &> /home/pi/logs/MLORPG &
  40.                     elif [[ "$(less /home/pi/update)" == "LOOBOT" ]]; then
  41.                         python3.7 -u /home/pi/LOOBOT/main.py &> /home/pi/logs/LOOBOT &
  42.                     elif [[ "$(less /home/pi/update)" == "FUGATSU" ]]; then
  43.                         python3.7 -u /home/pi/FUGATSUBOT/main.py &> /home/pi/logs/FUGATSU &
  44.                     elif [[ "$(less /home/pi/update)" == "PROFLIGACY" ]]; then
  45.                         python3.7 -u /home/pi/PROFLIGACYBOT/main.py &> /home/pi/logs/PROFLIGACY &
  46.                     else
  47.                         echo "Update unknown"
  48.                     fi
  49.                     echo "removing update"
  50.                     rm /home/pi/update
  51.                 else
  52.                     echo "killing all bots, creating logs2"
  53.                     for pid in $(pidof python3.7); do sudo kill -9 $pid; done
  54.                     cp -r /home/pi/logs/. /home/pi/logs2/
  55.                    
  56.                 fi
  57.             fi 
  58.         fi     
  59.         if [[ "$(pidof pinger)" == "" ]]; then
  60.             /home/pi/TchernobogNetworkBOT/pinger &> /home/pi/logs/pingerlog &
  61.         fi
  62.     else
  63.         echo "Offline"
  64.         for pid in $(pidof python3.7); do sudo kill -9 $pid; done
  65.         for pid in $(pidof pinger); do sudo kill -9 $pid; done
  66.     fi
  67.     echo "Sleeping 30"
  68.     sleep 30
  69. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement