I am running RHEL5 and software RAID (mdadm). Currently I allow the 99-raid-check weekly cron script to run at the normal time (early Sunday morning). However, if the system is off during that time it will run when the system boots with a delay. Looking at the man page for anacrontab and /etc/anacrontab, I can see the current config is set to run every 7 days with a delay of 70 minutes for the cron.weekly scripts. I need to be able to predict when there will be high disk IO, so I want it to run early Sunday morning if it's on, or not at all. My question is, how can I prevent 99-raid-check just to wait until the following week to run and not utilize anacron?
1 Answer
The simplest option would be to modify your script to check for I/O load and only run if it is below a threshold. Use something like iostat
and add a check in your script that will only run if I/O is below X. You can then leave the cron
as is since the script itself will deal with checking the load.
-
thank you for your comment. However this would not fulfill my needs. The IO will spike when mdadm rebuilds the arrays, which is fine, but I want to be able to control the hours that it occurs.– SteveRSep 18, 2013 at 14:58
-
@user2789281 if all you want tis for it to run Sunday morning or not at all, just use a normal
crontab
and give it a specific time.– terdonSep 18, 2013 at 15:02 -
yes, I think that's exactly what I will do since anacrontab doesn't read crontab. Thanks.– SteveRSep 18, 2013 at 15:10