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%' 
  • you have to be more specific: what is the purpose of some_command?
    – user601
    Commented Sep 13, 2010 at 23:11
  • from your question it is not clear whether you talk about seti@home or some delayed maintenance script.
    – user601
    Commented Sep 14, 2010 at 7:44
  • a script to run when the pc isn't too busy....
    – Stefan
    Commented Sep 14, 2010 at 9:09
  • 2
    no hop, im not trying to be thick nor am I trying to be rude. I'm going assume my question is clear enough as the 3 answers recieved are all spot-on.
    – Stefan
    Commented Sep 14, 2010 at 11:47
  • 1
    This is a good question @Stefan. At my previous job we ran alot of load-dependent Oracle batch jobs using DBMS_JOB, and it's common to only run jobs when the load falls below a particular level. I often wished we could do this well using cron, but we only came up with hackish solutions. Commented Sep 20, 2010 at 23:13

4 Answers 4


Fcron has a lot of additional features over common cronds. For example:

  • set the max system load average value under which the job should be run

(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.

  • From 'man batch' on my Fedora 14 system: batch executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified in the invocation of atd.
    – dr-jan
    Commented Feb 10, 2011 at 11:48

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.

  • 3
    Keep in mind that 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.
    – Jim Dennis
    Commented 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .