backup.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. IP=$(wget -qO- icanhazip.com);
  9. date=$(date +"%Y-%m-%d")
  10. clear
  11. echo " Enter Your Email To Receive Message"
  12. read -rp " Email: " -e email
  13. sleep 1
  14. echo Membuat Directory
  15. mkdir /root/backup
  16. sleep 1
  17. echo Start Backup
  18. clear
  19. cp /etc/passwd backup/
  20. cp /etc/group backup/
  21. cp /etc/shadow backup/
  22. cp /etc/gshadow backup/
  23. cp -r /etc/wireguard backup/wireguard
  24. cp /etc/ppp/chap-secrets backup/chap-secrets
  25. cp /etc/ipsec.d/passwd backup/passwd1
  26. cp /etc/shadowsocks-libev/akun.conf backup/ss.conf
  27. cp -r /var/lib/premium-script/ backup/premium-script
  28. cp -r /home/sstp backup/sstp
  29. cp -r /etc/v2ray backup/v2ray
  30. cp -r /etc/trojan backup/trojan
  31. cp -r /usr/local/shadowsocksr/ backup/shadowsocksr
  32. cp -r /home/vps/public_html backup/public_html
  33. cd /root
  34. zip -r $IP-$date.zip backup > /dev/null 2>&1
  35. rclone copy /root/$IP-$date.zip dr:backup/
  36. url=$(rclone link dr:backup/$IP-$date.zip)
  37. id=(`echo $url | grep '^https' | cut -d'=' -f2`)
  38. link="https://drive.google.com/u/4/uc?id=${id}&export=download"
  39. echo -e "The following is a link to your vps data backup file.
  40. Your VPS IP $IP
  41. $link
  42. If you want to restore data, please enter the link above.
  43. Thank You For Using Our Services" | mail -s "Backup Data" $email
  44. rm -rf /root/backup
  45. rm -r /root/$IP-$date.zip
  46. echo "Done"
  47. echo "Please Check Your Email"