1

I want to increase the niceness of an service (decrease the CPU priority) started as an dedicated user or group during the boot process. I'm not able to define the niceness or priority in the /etc/security/limits.conf or ./limits.d/ directory for the desired user because the entry will not be observed for services. (?)

Example

In particular I've a few small vServers with CentOS 6.6 and want to run a tor relay (The Onion Router) on each. The tor daemon starts on boot as a service, configured via sudo /sbin/chkconfig (run level: 2,3,4,5). The user and group for the tor process is _tor.

Where do I have to change the nice or priority level for every process the user _tor is the owner? The nice value should be applied on every boot and on manual service start (service tor start).

1
  • 1
    Using nice/ionice is a bit of a dated approach. Are you currently experiencing performance problems?
    – ewwhite
    Mar 5, 2015 at 13:33

1 Answer 1

0

The classical approach is to use nice and/or ionice within the service start-up script. You probably have something like:

case "$1" in
    start)
    echo "Starting tor daemon"
    /path/to/tor-daemon

and change that to

    echo "Starting tor daemon"
    nice /path/to/tor-daemon

Alternatively the start-up script often logs the PID of a daemon in /var/run/pid-of-tor-daemon or similar and you could use renice on that PID after the daemon has started.


A better approach is with cgroups. That is slightly too long for an answer here, but the Red Hat documentation might be a useful start.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .