Created
January 6, 2022 23:22
-
-
Save taidos/0705dea705bae4516d63af0ffb608253 to your computer and use it in GitHub Desktop.
cPanel Installatron Backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#EK | |
telegram() { | |
USERID="" | |
KEY="" | |
URL="https://api.telegram.org/bot${KEY}/sendMessage" | |
TEXT="${1}" | |
curl -s -d "chat_id=${USERID}&text=${TEXT}&disable_web_page_preview=true&parse_mode=markdown" $URL > /dev/null | |
} | |
userlist() { | |
cut -d':' -f1,2 /etc/userdomains | sed 's/:/ /g' | grep -Ev "nobody" | awk '{print $2 }' | sort | uniq -c | awk '{print $2}' > /root/userbackup.list | |
} | |
useridlist() { | |
for user in $(cat /root/userbackup.list); do | |
/usr/local/installatron/installatron --installs --user $user | jq -r '.data[] | ."id"' >> /root/userid.list | |
done | |
} | |
backup() { | |
for userid in $(cat /root/userid.list); do | |
/usr/local/installatron/installatron --backup --cmd backup --id $userid --expiry 7 | |
done | |
} | |
telegram "*$(hostname)* installatron backup islemi baslatildi." | |
rm -rf /root/userbackup.list | |
rm -rf /root/userid.list | |
userlist | |
useridlist | |
backup | |
telegram "*$(hostname)* installatron backup islemi tammalandi." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment