webmin.sh 2.2 KB

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