Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer
    
Thank you for that advice! That sounds promising. Going to do some tests. –  zuba Aug 10 '12 at 12:06
    
Shouldn't nice take 19 instead of -19 ? sudo nice 19 ionice -c 3 updatedb –  zuba Aug 10 '12 at 12:23
    
I found that /etc/cron.daily/mlocate runs updatedb.mlocate such way: /usr/bin/ionice -c3 /usr/bin/updatedb.mlocate. Is "-c3" proper param? man sais it should be "-c 3" –  zuba Aug 10 '12 at 12:26
1  
no, you need to prefix a - to the nice parameter. Only root can assign higher priority, which is...--20, say :). Either -c3 or -c 3 is fine. –  izx Aug 10 '12 at 12:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.