Created
March 21, 2018 14:57
-
-
Save joduplessis/2399164958a3f08e2c154cd7dcf31548 to your computer and use it in GitHub Desktop.
Backup pipeline running every day for a Linux VPS. Zips folder & files and FTPs to a location.
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 | |
# Change the directory | |
cd /home/username/backup | |
# First do our MySQL dump | |
mysqldump -u root -p "PASSWORD" --all-databases > alldb.sql | |
# Copy all sorted of stuff here to the backup folder | |
cp -r /home/username/files /home/username/backup/files | |
# Zip up everything, encrypt & password protect | |
zip -P SECRET -r /home/username/backup/backup.zip * | |
# FTP it off site | |
lftp -u FTP_USERNAME,FTP_PASSWORD FTP_HOST -e "put -O public_html/backup/ /home/username/backup/backup.zip; bye" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment