-
-
Save SilverCory/6ddcc0b515caa197032dd0fdd476fab7 to your computer and use it in GitHub Desktop.
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
NAME=$(hostname -f) | |
TIMESTAMP=$(date +%s) | |
echo Starting backup on $NAME | |
mkdir -p ~/backuptmp/ | |
echo Getting iptables... | |
iptables-save >~/backuptmp/iptables | |
echo Getting Webserver... | |
rsync -rq /var/www ~/backuptmp/www | |
echo Getting MySQL... | |
rsync -rq /etc/mysql ~/backuptmp/mysql | |
mysqldump --all-databases -u mysqldump > ~/backuptmp/mysqldump.sql | |
echo Getting Lets Encrypt certificates... | |
rsync -rq /etc/letsencrypt/live/ ~/backuptmp/letsencrypt | |
echo Getting Apache2 config... | |
rsync -rq /etc/apache2 ~/backuptmp/apache2 | |
echo Getting Nginx config... | |
rsync -rq /etc/nginx ~/backuptmp/nginx | |
echo Getting Jenkins home... | |
rsync -rq /var/lib/jenkins ~/backuptmp/jenkins | |
echo Getting Postfix config... | |
rsync -rq /etc/postfix ~/backuptmp/postfix | |
rsync -rq /var/mail ~/backuptmp/mail | |
cd ~/backuptmp/ | |
echo Compressing... | |
zip -rq backup.zip ./ | |
echo Encrypting... | |
gpg -r "fr34kyn01535" --batch --no-tty --trust-model always -e backup.zip | |
echo Sending... | |
mv ~/backuptmp/backup.zip.gpg ~/backuptmp/$TIMESTAMP.zip.gpg | |
ftp-upload -h dagobah.bam.yt -d /backup/$NAME ~/backuptmp/$TIMESTAMP.zip.gpg | |
echo Cleaning up... | |
rm ~/backuptmp/ -R |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment