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?
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:
- 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.
|All times are GMT -5. The time now is 03:26 AM.|