Changing CentOS/Scientific Linux to Check RAID Arrays Less Frequently

I have a rather large raid array at home and it takes a couple of days to run a check. Unfortunately, SL is configured to check the array every Sunday at 1am. While this may be convenient for business users that have fast CPUs and fast HBAs, it’s really inconvenient for me. So I decided to change it.

The weekend is when our RAID array gets used the most, for things like watching videos or using MythTV. The RAID check process also takes almost 3 days total, so I don’t want our HDDs going constantly for 3 out of 7 days of the week, it’ll destroy them.

What I really wanted to do is run the check once a month, but also on a particular day the week so I can avoid weekends (also the second instance of that day). Some cron magic and some command line ninja work did the job:

vi /etc/cron.d/raid-check

Edit the file to contain the following:

# Run system wide raid-check on the second Tuesday of each month
0 3 8-14 * * root test $(date +%u) -eq 2 && /usr/sbin/raid-check

The comment says it all. Simply modify the number after -eq to change the day.