how to *start* a process with a high priority
Notes: 1. by lower priority I mean that the priority number is lower. 2. Distro is RHE
I want to start a daemon with lower than normal priority (ie. say 18 rather than 20) so it will get cpu first in the case of contention.
nice runs commands at increased priority, renice can raise or lower but works for processes that are already running.
I would rather not have to dig the pid out of the process list and then call renice in the start script if I can avoid it since the program does not conveniently produce a pid file.
Solution 1:
You just launch it with nice.
E.g.:
nice -n 18 /path/to/mydaemon
Solution 2:
Additionally, you can use the ionice command to start the process with low io priority:
nice -n18 ionice -c3 /path/to/mydaemon