.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RENICED 1" .TH RENICED 1 "2016-05-15" "1.21" "reniced" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" reniced \- renice running processes based on regular expressions .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBreniced\fR [\fB\-h\fR] [\fB\-v\fR] [\fB\-o\fR\ \fIformat\fR] [\fIconfigfile\fR] .SH "OVERVIEW" .IX Header "OVERVIEW" 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. .SH "DESCRIPTION" .IX Header "DESCRIPTION" On start, reniced reads a configuration file. It consists of nice values and regular expressions. .PP It then scans the process table using the \fIps\fR\|(1) command. Whenever a process name from the \s-1CMD\s0 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. .PP When run as root, reniced will scan all processes (\f(CW\*(C`\`ps H \-e\`\*(C'\fR). When run as a user, renice only scans the user's processes (\f(CW\*(C`\`ps H \-\-user\`\*(C'\fR). .SS "Switches" .IX Subsection "Switches" .IP "\fB\-h\fR" 5 .IX Item "-h" This prints the version number, a short help text and exits without doing anything. .IP "\fB\-v\fR" 5 .IX Item "-v" This activates verbose mode. Error messages, some statistics and all renice actions are printed to stdout. .IP "\fB\-o\fR \fIformat\fR" 5 .IX Item "-o format" Set the \fIps\fR\|(1) output format to filter on. The default format is \&\f(CW\*(C`comm\*(C'\fR. See the \fB\-o\fR parameter in the \fIps\fR\|(1) manpage for details. .IP "\fIconfigfile\fR" 5 .IX Item "configfile" This reads the regular expressions from an alternate configfile. .Sp The default location of the configfile is \f(CW\*(C`/etc/reniced.conf\*(C'\fR if reniced is run as root, \f(CW\*(C`~/.reniced\*(C'\fR otherwise. .SS "Configuration file format" .IX Subsection "Configuration file format" The configuration file is composed of single lines. Empty lines and lines starting with a \fB#\fR are ignored. .PP Every line must consist of a command followed by a whitespace and a Perl regular expression. .PP The regular expression is matched against the \fIps\fR\|(1) output. For every matched process the command is executed. .PP 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. .PP \fICommand characters\fR .IX Subsection "Command characters" .IP "\fBn\fR" 5 .IX Item "n" Sets the nice value of a process. Must be followed by a number, usually within the range of \-20 to 19. .Sp For backwards compatibility a \fBn\fR at the beginning of the command can be left out (if the command starts with a number it is treated as a nice value). .IP "\fBr\fR" 5 .IX Item "r" Sets the io priority to the realtime scheduling class. The optional number is treated as class data (typically 0\-7, lower being higher priority). .IP "\fBb\fR" 5 .IX Item "b" Sets the io priority to the best-effort scheduling class. The optional number is treated as class data (typically 0\-7, lower being higher priority). .IP "\fBi\fR" 5 .IX Item "i" Sets the io priority to the idle scheduling class. No number needs to be given as the idle scheduling class ignores the class data value. .IP "\fBo\fR" 5 .IX Item "o" Sets the \s-1OOM\s0 killer adjustment in \f(CW\*(C`/proc/$PID/oom_adj\*(C'\fR to the given number. (Internally, \f(CW\*(C`/proc/$PID/oom_score_adj\*(C'\fR will be used when available, but for backwards compatibility this value is still expected the in old \f(CW\*(C`oom_adj\*(C'\fR format and will be converted automatically.) .PP \fIExamples\fR .IX Subsection "Examples" .ie n .IP """5 ^bash""" 5 .el .IP "\f(CW5 ^bash\fR" 5 .IX Item "5 ^bash" gives currently running bash shells a nice value of 5 .ie n .IP """b2 ^tar""" 5 .el .IP "\f(CWb2 ^tar\fR" 5 .IX Item "b2 ^tar" sets currently running tar-processes to io priority best-effort within class 2 .ie n .IP """i torrent""" 5 .el .IP "\f(CWi torrent\fR" 5 .IX Item "i torrent" sets currently running torrent-like applications to io priority idle .ie n .IP """n\-10r4 seti""" 5 .el .IP "\f(CWn\-10r4 seti\fR" 5 .IX Item "n-10r4 seti" gives currently running seti-processes a nice value of \-10 and sets them to realtime io priority in class 4 .SH "MODULES NEEDED" .IX Header "MODULES NEEDED" .Vb 1 \& use BSD::Resource; .Ve .PP This module can be obtained from . .SH "PROGRAMS NEEDED" .IX Header "PROGRAMS NEEDED" .Vb 2 \& ps \& ionice .Ve .PP ionice is only needed if you want to change io priority. It can be obtained from . .PP You also need a suitable kernel and scheduler, e.g. Linux 2.6 with \&\s-1CFQ.\s0 .SH "LIMITATIONS" .IX Header "LIMITATIONS" The purpose of reniced is to renice long running server processes (hence the \fBd\fR for daemon in it's name). .PP 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. .SH "BUGS" .IX Header "BUGS" reniced can run without the BSD::Resource module. In this case, the \&\s-1PRIO_PROCESS\s0 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. .PP Be careful using realtime priorities, don't starve other tasks. .PP Please report bugs to <\fImitch@cgarbs.de\fR>. .SH "AUTHOR" .IX Header "AUTHOR" reniced was written by Christian Garbs <\fImitch@cgarbs.de\fR>. .SH "COPYRIGHT" .IX Header "COPYRIGHT" reniced is Copyright (C) 2005 by Christian Garbs. It is licensed under the \s-1GNU GPL\s0 v2 or later. .SH "AVAILABILITY" .IX Header "AVAILABILITY" Look for updates at . .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIionice\fR\|(1), \fIrenice\fR\|(1), \fIps\fR\|(1)