So cron
or at
can schedule our commands to run at the exact time we need them to, but can we schedule commands to run when systems are inactive?
Something like:
echo "some_commands" | when 'cpu < 15%'
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitySo cron
or at
can schedule our commands to run at the exact time we need them to, but can we schedule commands to run when systems are inactive?
Something like:
echo "some_commands" | when 'cpu < 15%'
Fcron has a lot of additional features over common cronds. For example:
(quote from the Homepage)
Thus, you could use fcron to setup what you want.
On many systems the at daemon is configured such that the batch
command will run a command when the system drops below a certain load. However, this may not give you the fine grained control you are looking for.
hmmm... I don't think so... but what you could do is cron a script to run like every 5 minutes and check the load average to see if it's acceptably low. I wouldn't check the current because you could get the cpu in between 2 really high peaks. This is just thoughts on what I'd do to accomplish this, but there might be a better way.
uptime
reports load averages for three different intervals (last minute, last five minutes and last fifteen minutes). In general load average is only the average number of items in the run queue during that time interval. On some systems (Linux in particular) processes in "D" state are counted as runnable. So a system with processes waiting on a slow (or missing) NFS server can appear to have a large load average that has nothing to do with real load on the system.
Sep 14, 2010 at 3:49
A friend of mine posted about this problem some days ago. He talks about this tool Dmon. I did not test it, but it sounds great.