RENICED(1) | reniced | RENICED(1) |
reniced - renice running processes based on regular expressions
reniced [-h] [-v] [-o format] [configfile]
reniced takes a list of regular expressions, looks for processes (and threads) matching them and renices the processes to given values. reniced can also change io priorities.
On start, reniced reads a configuration file. It consists of nice values and regular expressions.
It then scans the process table using the ps(1) command. Whenever a process name from the CMD column matches a regular expression, that process is reniced to the given value. If a process matches multiple regular expressions, all rule matches are executed in order and the last match wins.
When run as root, reniced will scan all processes ("`ps H -e`"). When run as a user, renice only scans the user's processes ("`ps H --user`").
The default location of the configfile is "/etc/reniced.conf" if reniced is run as root, "~/.reniced" otherwise.
The configuration file is composed of single lines. Empty lines and lines starting with a # are ignored.
Every line must consist of a command followed by a whitespace and a Perl regular expression.
The regular expression is matched against the ps(1) output. For every matched process the command is executed.
A command generally takes the form of a character followed by a number. Multiple commands can be given simultaneously with no spaces inbetween. Sometimes the number is optional.
Command characters
For backwards compatibility a n at the beginning of the command can be left out (if the command starts with a number it is treated as a nice value).
Examples
use BSD::Resource;
This module can be obtained from <http://www.cpan.org>.
ps ionice
ionice is only needed if you want to change io priority. It can be obtained from <http://rlove.org/schedutils/>.
You also need a suitable kernel and scheduler, e.g. Linux 2.6 with CFQ.
The purpose of reniced is to renice long running server processes (hence the d for daemon in it's name).
Selecting and renicing processes it not atomic: There is a small gap between scanning the process list and renicing the processes. If you target short-lived processes with your regular expressions, reniced might try to act on a process that is already gone. In the worst case it might renice a new process that got the same process id as the already ended process that was matched.
reniced can run without the BSD::Resource module. In this case, the PRIO_PROCESS is set to 0. This works on Linux 2.6.11 i686 but it could break on other systems. Installing BSD::Resource is the safer way.
Be careful using realtime priorities, don't starve other tasks.
Please report bugs to <mitch@cgarbs.de>.
reniced was written by Christian Garbs <mitch@cgarbs.de>.
reniced is Copyright (C) 2005 by Christian Garbs. It is licensed under the GNU GPL v2 or later.
Look for updates at <https://github.com/mmitch/reniced>.
2016-05-15 | 1.21 |