Opium mysql backup
Opium mysql backup
Create a credintals file my.cnf and add the following
[client] user = dbuser password = dbpasswd
Restrict permissions of the credentials file so that only your user has access to it:
chmod 600 ~/my.cnf
Back command
/usr/bin/mysqldump --defaults-file=~/my.cnf cycling > /media/EADC-661E/radio/.hledger/db-backup/cycling-$(date +\%Y\%m\%d).sql
You can also create another cronjob to delete any backups older than 30 days:
find /path/to/backups -type f -name "*.sql" -mtime +30 -delete
Of course, you need to adjust the command according to your backup location and file names
https://linuxize.com/post/how-to-find-files-in-linux-using-the-command-line/