I am using the latest Linux Mint. I was wondering if it's possible to create a special cronjob for a database backup.
In my /etc/cronjob
file I have the following code:
# Minute Hour Day of Month Month Day of Week Command
# (0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)
30 4 * * 1-6 /home/users/backup.sh
In my /home/users/backup.sh
I have:
mysqldump -uroot -p MyDatabase > /home/users/backup_MyDB/full_myDB.sql
Instead of full_myDB.sql
I would like to have something like 2014-04-04_full_myDB.sql
where the date is added dynamically depending on the date we have.
If the SQL Backup file is older than one week I would like the cronjob to delete it automatically.