Running cronjob in the odd-numbered days

Posted by Spacedust on Server Fault See other posts from Server Fault or by Spacedust
Published on 2012-06-29T17:56:38Z Indexed on 2012/06/29 21:18 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

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 ?

© Server Fault or respective owner

Related posts about mysql

Related posts about cron