Guest User

Untitled

a guest
Jun 10th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.     COL_GREEN="\x1b[32;01m"
  4.     COL_RED="\x1b[31;02m"
  5.     function text {
  6.         echo -e "\x1b[$1 $2\e[0m"
  7.     }
  8.  
  9.     function start {
  10.         if ! screen -list | grep -q "botphp1"; then
  11.             screen -AdmS botphp1 php bot.php -i 1
  12.             text "32;01m" "Pomyslnie uruchomiono bota nr 1!"
  13.         else
  14.             text "31;02m" "Bot nr 1 jest juz uruchomiony!"
  15.         fi
  16.         if ! screen -list | grep -q "botphp2"; then
  17.             screen -AdmS botphp2 php bot.php -i 2
  18.             text "32;01m" "Pomyslnie uruchomiono bota nr 2!"
  19.         else
  20.             text "31;02m" "Bot nr 2 jest juz uruchomiony!"
  21.         fi
  22.     }
  23.  
  24.     function stop {
  25.         if ! screen -list | grep -q "botphp1"; then
  26.             text "31;02m" "Bot nr 1 nie był uruchomiony więc nie został zatrzymany"
  27.         else
  28.             text "32;01m" "Pomyslnie zatrzymano bota  nr 1!"
  29.             screen -X -S botphp1 stuff "^C"
  30.         fi
  31.         if ! screen -list | grep -q "botphp2"; then
  32.             text "31;02m" "Bot nr 2 nie był uruchomiony więc nie został zatrzymany"
  33.         else
  34.             text "32;01m" "Pomyslnie zatrzymano bota nr 2!"
  35.             screen -X -S botphp2 stuff "^C"
  36.         fi
  37.     }
  38.  
  39.     function restart {
  40.         if ! screen -list | grep -q "botphp1"; then
  41.             text "31;02m" "Bot nr 1 nie był uruchomiony"
  42.         else
  43.             text "32;01m" "Pomyslnie zatrzymano bota nr 1!"
  44.             screen -X -S botphp1 stuff "^C"
  45.         fi
  46.         if ! screen -list | grep -q "botphp2"; then
  47.             text "31;02m" "Bot nr 2 nie był uruchomiony"
  48.         else
  49.             text "32;01m" "Pomyslnie zatrzymano bota nr 2!"
  50.             screen -X -S botphp2 stuff "^C"
  51.         fi
  52.         screen -AdmS botphp1 php bot.php -i 1
  53.         text "32;01m" "Pomyslnie uruchomiono bota nr 1!"
  54.         screen -AdmS botphp2 php bot.php -i 2
  55.         text "32;01m" "Pomyslnie uruchomiono bota nr 2!"
  56.     }
  57.  
  58.     clear
  59.     text "32;01m" "
  60. _______ _____ ____    ____        _     _             __  __       _                
  61. |__   __/ ____|___ \  |  _ \      | |   | |           |  \/  |     (_)                
  62.   | | | (___   __) | | |_) | ___ | |_  | |__  _   _  | \  / | __ _ _  ___ ___  _ __  
  63.   | |  \___ \ |__ <  |  _ < / _ \| __| | '_ \| | | | | |\/| |/ \` | |/ __/ _ \| '_ \
  64.   | |  ____) |___) | | |_) | (_) | |_  | |_) | |_| | | |  | | (_| | | (_| (_) | | | |
  65.   |_| |_____/|____/  |____/ \___/ \__| |_.__/ \__, | |_|  |_|\__,_| |\___\___/|_| |_|
  66.                                                __/ |             _/ |                
  67.                                               |___/             |__/                
  68.     "
  69.  
  70.    
  71.     case "$1" in
  72.         "start")
  73.             start
  74.         ;;
  75.  
  76.         "stop")
  77.             stop
  78.         ;;
  79.  
  80.         "restart")
  81.             restart
  82.         ;;
  83.  
  84.         *)
  85.             echo -e 'Uzyj start | stop | restart'
  86.         ;;
  87.     esac
Advertisement
Add Comment
Please, Sign In to add comment