I'm currently running my MySQL backup script on every day of the week:
0 1 * * 1 sh /root/mysql_monday.sh
0 1 * * 2 sh /root/mysql_tuesday.sh
0 1 * * 3 sh /root/mysql_wednesday.sh
0 1 * * 4 sh /root/mysql_thursday.sh
0 1 * * 5 sh /root/mysql_friday.sh
0 1 * * 6 sh /root/mysql_saturday.sh
0 1 * * 0 sh /root/mysql_sunday.sh
Now I would like to keep backups for one week more so two weeks in total just to be more secure.
For example: I though I can create one backup file on monday in the even days and then again in the odd-numbered days.
For even days I can just use:
0 1 */2 * 1 sh /root/mysql_monday_even.sh
0 1 */2 * 2 sh /root/mysql_tuesday_even.sh
0 1 */2 * 3 sh /root/mysql_wednesday_even.sh
0 1 */2 * 4 sh /root/mysql_thursday_even.sh
0 1 */2 * 5 sh /root/mysql_friday_even.sh
0 1 */2 * 6 sh /root/mysql_saturday_even.sh
0 1 */2 * 0 sh /root/mysql_sunday_even.sh
But what about the odd-numbered days ?
I found this on unix.stackexchange:
Source: Odd/Even Cron
Surely a better solution would just be to use a proper MySQL backup script designed for weekly, monthly, yearly retention?
Automysqlbackup should work just perfect.
http://sourceforge.net/projects/automysqlbackup/
I did it my way ;)
Crontab generator
http://www.openjs.com/scripts/jslibrary/demos/crontab.php