Last active
June 23, 2023 07:22
-
-
Save philipp-r/59506a2c8a7b38e98408a121ab8b2e4a to your computer and use it in GitHub Desktop.
Backup MySQL database with MEGAcmd https://github.com/meganz/MEGAcmd/
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 | |
DATE=`date +%Y-%m-%d-%H-%M` | |
# PATH | |
PATH=/bin:/usr/bin:/usr/local/bin | |
# mysql dump | |
mysqldump -u nextcloud_backup -pPASSWORD --databases nextcloud > mysql_$DATE.sql | |
wait | |
# zip | |
7z a -mhe=on -pPASSWORD mysql_$DATE.7z mysql_$DATE.sql | |
wait | |
# backup with mega.nz | |
mega-put mysql_$DATE.7z / | |
wait | |
# delete the oldest backup from mega | |
mega-rm -rf `mega-ls / | awk 'NR<2'` | |
# delete dumped file | |
rm -f mysql_$DATE.sql | |
rm -f mysql_$DATE.7z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment