Advertisement
Falexom

Untitled

Jul 25th, 2022
1,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.03 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. NORMAL='\033[0m'
  4.  
  5. WHITE='\033[1;37m'
  6.  
  7. BGRED='\033[41m'
  8. BGGREEN='\033[42m']
  9. BGBLUE='\033[44m'
  10.  
  11. ngnixstatus=$(systemctl status nginx | grep -Eo "running|dead|failed")
  12.  
  13. if [[ $nginxstatus = 'running' ]]
  14. then
  15. echo -en "${WHITE} ${BGGREEN}Web server is running! ${NORMAL}\n"
  16. else
  17. echo -en "${WHITE} ${BGRED}nginx doesn't work! ${NORMAL}\n"
  18. systemctl restart nginx
  19. sleep 1
  20. echo -en "${WHITE} ${BGGREEN}Status Nginx after reboot $(systemctl status nginx | grep -Eo "running|dead|failed") ${NORMAL}\n"
  21. echo $(curl -I 192.168.124.131 | grep  OK)
  22. fi
  23.  
  24. phpstatus=$(systemctl status php7.4-fpm | grep -Eo "running|dead|failed")
  25.  
  26. if [[ $nginxstatus = 'running' ]]
  27. then
  28. echo -en "${WHITE} ${BGGREEN}Web server is running! ${NORMAL}\n"
  29. else
  30. echo -en "${WHITE} ${BGRED}php-fpm doesn't work! ${NORMAL}\n"
  31. systemctl restart php7.4-fpm
  32. sleep 1
  33. echo -en "${WHITE} ${BGGREEN}Status php-fpm after reboot $(systemctl status php7.4-fpm  | grep -Eo "running|dead|failed") ${NORMAL}\n"
  34. echo $(curl -I 192.168.124.131 | grep  OK)
  35. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement