LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 05-26-2013, 08:39 PM   #1
Gullible Jones
Member
 
Registered: Apr 2011
Posts: 141

Rep: Reputation: 10
Any sane way to renice a process by path, every time it is started?


Say you have a situation where you want a given program to always run at a certain niceness, regardless of who invokes it or how. What's a sensible way to do this? verynice would probably work, but seems like enormous overkill; and using a cron job would be... well, not very sensible.

What I'd like to do is write a script that watches continuously for the start of some process, renices it *once* as soon as it is launched, and then leaves it alone. What methods are available for checking on processes this way?
 
Old 05-27-2013, 02:33 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
Maybe you could use a wrapper script to accomplish this?

If the given program always needs its niceness to be adjusted you could try the following:

- Rename the given program: mv given_program given_program.org
- Create a wrapper script named given_program with the following content:
Code:
#!/bin/bash

nice -n 19 given_program.org "$@"
Make sure that:
- The wrapper script is in the same location as the original,
- The wrapper script has the same owner/permissions as the original program.

BTW: The "$@" part makes sure that all the (possible) options/parameters are given to the original program.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
renice process to allow it 100% cpu usage rey Linux - Software 1 11-22-2012 04:45 PM
How to find which process started a daemon process in autostart? indiajoe Linux - Desktop 4 10-25-2011 02:19 AM
[SOLVED] Date and time of a process when it was started mario.almeida Linux - General 1 03-19-2010 10:46 AM
Renice a process yenonn Linux - General 2 10-03-2005 07:59 PM
about renice the process Rex_chaos Linux - General 5 08-01-2004 06:24 AM


All times are GMT -5. The time now is 09:18 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration