Linux – how to *start* a process with a high priority

linuxnice

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.

Best Answer

You just launch it with nice.

E.g.:

nice -n 18 /path/to/mydaemon