File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ mkdir ${BACKUP_DIR}
1212cd ${BACKUP_DIR}
1313
1414# Delete the oldest files by only listing out everything older than the newest 7 files
15- ls * .gz.enc | sort | tail -n +7 | xargs rm
16- ls * .gz. passphrase.enc | sort | tail -n +7 | xargs rm
15+ ls * .tar. gz.enc | sort | tail -n +7 | xargs rm
16+ ls * .passphrase.enc | sort | tail -n +7 | xargs rm
1717
1818# Backup the MySQL databases
1919mysqldump -u< username> -p< password> production > production.sql
@@ -28,10 +28,10 @@ openssl rand 32 -out ${BACKUP_PASSPHRASE_FILE}
2828openssl enc -aes-256-cbc -pass file:${BACKUP_PASSPHRASE_FILE} < ${BACKUP_FILE} > ${BACKUP_FILE_ENCRYPTED}
2929
3030# Encrypt the passphrase
31- openssl rsautl -encrypt -pubin -inkey ~ /public-key.pem < ${BACKUP_PASSPHRASE_FILE} > ${BACKUP_PASSPHRASE_FILE_ENCRYPTED}
31+ openssl rsautl -encrypt -pubin -inkey /root /public-key.pem < ${BACKUP_PASSPHRASE_FILE} > ${BACKUP_PASSPHRASE_FILE_ENCRYPTED}
3232
3333# Clean up
34- rm ${BACKUP_FILE} ${BACKUP_PASSPHRASE_FILE}
34+ rm ${BACKUP_FILE} ${BACKUP_PASSPHRASE_FILE} * .sql
3535
3636# Copy offsite
3737# scp ${BACKUP_FILE_ENCRYPTED} ${BACKUP_PASSPHRASE_FILE_ENCRYPTED} <username>@<backup-server>:backups/.
You can’t perform that action at this time.
0 commit comments