daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 1,977 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env bash
  2. red=$'\e[1;31m'
  3. grn=$'\e[1;32m'
  4. yel=$'\e[1;33m'
  5. blu=$'\e[1;34m'
  6. mag=$'\e[1;35m'
  7. cyn=$'\e[1;36m'
  8. end=$'\e[0m'
  9. clear
  10. echo -e "##### Skrip delete domain by Hardinal #####"
  11. echo -e "Web: \e[32mhttps://jasa.hardinal.com/${end}"
  12. echo -e "Email: \e[33mjasa@hardinal.com${end}"
  13. echo "_________________"
  14. rm -f domain.txt domain-tanpa-titik.txt db_name.txt db_name1.txt u_name.txt u_name1.txt
  15. echo
  16. echo "${yel}PERHATIAN!!!${end} Semua data web akan terhapus"
  17. echo "Kalo size web puluhan atau ratusan GB, bisa makan waktu lama berjam-jam"
  18. echo
  19. printf "Berikut adalah daftar domain yang ada di server ini"
  20. echo
  21. echo "________________"
  22. echo
  23. ls -I default -I phpmyadmin -I filemanager -1 /etc/nginx/sites-enabled/
  24. echo "________________"
  25. echo
  26. echo "Silahkan ketik nama domain yang ingin dihapus"
  27. echo "Kalo salah input hapus dengan CTRL + Backspace"
  28. echo
  29. while true
  30. do
  31.         read -p $'\e[34m'"Domain${end}: " domain
  32.         read -p $'\e[34m'"Masukan nama domain sekali lagi${end}: " domain2
  33.         echo
  34.         [ "$domain" = "$domain2" ] && break
  35.         echo "Nama domain ga cocok, ulang lagi ya!"
  36. done
  37. echo $domain >> domain.txt
  38. periksa="/etc/nginx/sites-available/$domain"
  39. if [ -f "$periksa" ]
  40. then
  41.     clean_domain_1=`sed 's/[^a-zA-Z0-9]//g'  domain.txt > domain-tanpa-titik.txt`
  42.     untuk_db=`cat domain-tanpa-titik.txt`
  43.     echo $untuk_db >> db_name1.txt
  44.     echo $untuk_db >> u_name1.txt
  45.     sed 's/^/db_/' db_name1.txt > db_name.txt
  46.     sed 's/^/u_/' u_name1.txt > u_name.txt
  47.     db_name=`cat db_name.txt`
  48.     u_name=`cat u_name.txt`
  49.     rm -f domain.txt domain-tanpa-titik.txt db_name.txt db_name1.txt u_name.txt u_name1.txt
  50.     echo
  51.     read -p $'\e[31m'"YAKIN INGIN MENGHAPUS DOMAIN BESERTA ISINYA?${end} <y/t>${end}" tanya
  52.     echo
  53.     if [[ $tanya == "y" || $tanya == "Y" || $tanya == "yes" || $tanya == "Yes" || $tanya == "Ya" || $tanya == "ya" ]]
  54.     then
  55.         password_root_mysql=`cat /root/.pwdmysql`
  56.         mysql -uroot -p$password_root_mysql -e "DROP DATABASE $db_name;"
  57.         mysql -uroot -p$password_root_mysql -e "DROP USER '$u_name'@'localhost';"
  58.         rm -f domain.txt domain-tanpa-titik.txt db_name.txt db_name1.txt u_name.txt u_name1.txt
  59.         rm -fr /var/www/html/$domain
  60.         rm -fr /etc/nginx/untuk_cache/$domain
  61.         unlink /etc/nginx/sites-enabled/$domain
  62.         rm -f /etc/nginx/sites-available/$domain
  63.         rm -f /var/log/nginx/$domain.error.log
  64.         rm -f /etc/php5/fpm/pool.d/$domain.conf
  65.         rm -f /etc/php/5.6/fpm/pool.d/$domain.conf
  66.         rm -f /etc/php/7.0/fpm/pool.d/$domain.conf
  67.         rm -f /etc/php/7.2/fpm/pool.d/$domain.conf
  68.         rm -f /etc/php/7.3/fpm/pool.d/$domain.conf
  69.         rm -fr /etc/ssl/$domain
  70.         service nginx reload
  71.         echo
  72.         echo "Domain $domain beserta semua isinya file web + database baru saja dihapus"
  73.         echo
  74.         debversion=`lsb_release -sc`
  75.         php -r \@phpinfo\(\)\; | grep 'PHP Version' -m 1 > versi-php.txt
  76.         awk '{ print $4 }' versi-php.txt > versi-php1.txt
  77.         cut -c -1 versi-php1.txt > jessie_php.txt
  78.         jessie_php=`cat jessie_php.txt`
  79.         cut -c -3 versi-php1.txt > stretch_php.txt
  80.         stretch_php=`cat stretch_php.txt`
  81.         rm -f versi-php.txt versi-php1.txt jessie_php.txt stretch_php.txt
  82.         if [ "$debversion" = "jessie" ]; then
  83.                 if [ $jessie_php = 5 ]
  84.                 then
  85.                 service php5-fpm reload
  86.                 else
  87.                 service php7.0-fpm reload
  88.                 fi
  89.         elif [ "$debversion" = "stretch" ]; then
  90.             service php$stretch_php-fpm reload
  91.         fi
  92.     else
  93.         rm -f db_name1.txt  db_name.txt  domain-tanpa-titik.txt  domain.txt  u_name1.txt  u_name.txt
  94.         exit 0
  95.     fi
  96. else
  97.     rm -f domain.txt
  98.     echo "${red}Domain ngga bisa dihapus${end}, karena domain tidak disimpan di server ini."
  99.     echo "Berikut adalah daftar domain yang ada di server ini"
  100.     echo "________________"
  101.     echo
  102.     ls -I default -I phpmyadmin -I filemanager -1 /etc/nginx/sites-enabled/
  103.     echo "________________"
  104.     echo
  105.     echo "Silahkan jalankan kembali skrip ini."
  106.     echo
  107.     exit 0
  108. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top