webmin.sh 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- https://icanhazip.com);
  6. echo "Checking VPS"
  7. Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
  8. Info="${Green_font_prefix}[Installed]${Font_color_suffix}"
  9. Error="${Red_font_prefix}[Not Installed]${Font_color_suffix}"
  10. cek=$(netstat -ntlp | grep 10000 | awk '{print $7}' | cut -d'/' -f2)
  11. function install () {
  12. IP=$(wget -qO- ifconfig.co);
  13. echo " Adding Repositori Webmin"
  14. sh -c 'echo "deb http://download.webmin.com/download/repository sarge contrib" > /etc/apt/sources.list.d/webmin.list'
  15. apt install gnupg gnupg1 gnupg2 -y
  16. wget http://www.webmin.com/jcameron-key.asc
  17. apt-key add jcameron-key.asc
  18. echo " Start Install Webmin"
  19. clear
  20. sleep 0.5
  21. apt update > /dev/null 2>&1
  22. apt install webmin -y
  23. sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
  24. /etc/init.d/webmin restart
  25. rm -f /root/jcameron-key.asc
  26. clear
  27. echo ""
  28. echo " Done Install Webmin"
  29. echo " $IP:10000"
  30. echo " AutoScriptVPS By OkkayKayyo"
  31. }
  32. function restart () {
  33. echo " Restarting Webmin"
  34. sleep 0.5
  35. service webmin restart > /dev/null 2>&1
  36. echo " Start Uninstall Webmin"
  37. clear
  38. echo ""
  39. echo " Done Restart Webmin"
  40. echo " AutoScriptVPS By OkkayKayyo"
  41. }
  42. function uninstall () {
  43. echo " Removing Repositori Webmin"
  44. rm -f /etc/apt/sources.list.d/webmin.list
  45. apt update > /dev/null 2>&1
  46. echo " Start Uninstall Webmin"
  47. clear
  48. sleep 0.5
  49. apt autoremove --purge webmin -y > /dev/null 2>&1
  50. clear
  51. echo ""
  52. echo " Done Uninstall Webmin"
  53. echo " AutoScriptVPS By OkkayKayyo"
  54. }
  55. if [[ "$cek" = "perl" ]]; then
  56. sts="${Info}"
  57. else
  58. sts="${Error}"
  59. fi
  60. clear
  61. echo -e " =============================="
  62. echo -e " Webmin Menu "
  63. echo -e " =============================="
  64. echo -e " Status $sts"
  65. echo -e " 1. Install Webmin"
  66. echo -e " 2. Restart Webmin"
  67. echo -e " 3. Uninstall Webmin"
  68. echo -e " AutoScriptVPS By OkkayKayyo"
  69. echo -e " Press CTRL+C to return"
  70. read -rp " Please Enter The Correct Number : " -e num
  71. if [[ "$num" = "1" ]]; then
  72. install
  73. elif [[ "$num" = "2" ]]; then
  74. restart
  75. elif [[ "$num" = "3" ]]; then
  76. uninstall
  77. else
  78. clear
  79. echo " You Entered The Wrong Number"
  80. menu
  81. fi