webmin.sh 2.1 KB

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