How do I run an I/O intensive application only when the computer is idle?

Is there a tool which can be instructed to pause specified processes if user uses a keyboard or mouse and to resume it in certain time after user has stopped interaction to the OS?

I would like to treat such way annoying mlocate update db, backuppc.

ps

09.2015 I guess these useful utils bothered me 'cause my Ubuntu was in fact a server, not a desktop.


Solution 1:

Use the ionice utility to set a command's I/O priority to idle - this way it won't hog your hard disk when you are working, potentially slowing you down.

The syntax is:

ionice -c 3 command-name
  • -c 3 sets I/O priority to idle. See man ionice for more information.
  • Don't forget to prefix sudo if the command itself requires sudo, e.g. updatedb
  • You can also use nice at the same time to set CPU priority to "idle" too, e.g.

    sudo nice -19 ionice -c 3 updatedb

Note: if the application is run via cron, you should also consider changing the scheduled time to when you least use your computer.