Table of Contents

Name

griller - kill processes if load or their running time raise

Synopsis

griller

Description

griller ist ein Prozess-Griller. It means that user processes which become too old will be barbecued (killed). A raising load will limit the allowed process age even more.

griller is designed to run forever. It scans every four seconds the /proc directory for processes to be killed. If it has trouble to start it exits with an appropriate return code as defined in sysexits.h.

griller doesn’t use any arguments or resource files. It reads some environment variables for its configuration.

KILL_LEVEL specifies the maximum process age in seconds which is allowed at load per one minute average of 1 ("load1"). Default when not set is 3600.
MINUID specifies the minimum user id of processes which may be grilled. Default is 500.
MAXUID specifies the minimum user id of processes which may be grilled. Default is 0 which means "off".
KILLING_OFF disables killing when set. In this case only logging will be done and processes that would be killed will be listed with "pseudokilling".
MAXLOADSOFT specifies the level of "load1" at which the maximum process age is calculated to be 0. If MAXLOADSOFT is reached by an UID then griller will start a new scan without sleeping.
MAXLOADHARD specifies the level of "load" above MAXLOADSOFT at which the scanning and killing of procs will be speed up internally.
PROCSOFTLIMIT specifies the number of processes of a single uid at which all processes of this uid only get a fourth of the time of KILL_LEVEL.
PROCHARDLIMIT specifies the number of processes of a single uid at which all processes of this uid will be immediately killed. If PROCHARDLIMIT is reached by an UID then griller will start a new scan without sleeping.
CMDLINE_EXCLUDES specifies substrings (no regex) of command lines of processes which are excluded from killing. Up to 100 substrings can be specified with semicolon ";" as separator.
USERIGNORE specifies users which will be ignored by griller and his killing. Users specified here will also ignored even if they are in the range of MINUID to MAXUID. See GRILLER PATTERNS for how to specify users. Up to 100 users can be specified.
USERQUADTIME specifies users which will get 4 times of the normal allowed process age. See GRILLER PATTERNS for how to specify users. Up to 100 users can be specified.
RSS_SOFTLIMIT specifies a limit of RSS in KB. Processes with more RSS than RSS_SOFTLIMIT will get 3 times of the normal kill score. If not specified or set to 0 then the check is disabled.

griller writes its logging and stats data to stdout. More explanation of the columns in logging output is done in lps(1) . The usage of tools like multilog (daemontools) is recommended. To run griller as a "background process" you may use something like daemonize or daemontools.

Griller Patterns

These patterns for specifying a list of user matching strings use 3 special chars:
Caret ^ matches the beginning of a string.
Dollar sign $ matches the end of a string.
Bar | separates two patterns.
Pattern example: USERIGNORE="^root$|^cronstats$"

See Also

lps(1) , daemonize(1)

http://www.tuxad.de/

Examples

Example usage with daemontools:
$ ls -l /service/
lrwxrwxrwx 1 root root 12 Jul 3 10:58 griller -> /opt/griller
$ cat /opt/griller/run
#!/bin/bash
exec 2>&1
source /etc/grillfisch.d/griller.rc
exec /opt/griller/bin/griller
$ cat /opt/griller/log/run
#!/bin/sh
exec setuidgid griller multilog t s999999 n20 ./main
$ cat /etc/grillfisch.d/griller.rc
export KILL_LEVEL=1800
export MINUID=10000
export MAXUID=65533
unset KILLING_OFF
export MAXLOADSOFT=40
export MAXLOADHARD=60
export PROCSOFTLIMIT=15
export PROCHARDLIMIT=35
export CMDLINE_EXCLUDES="SCREEN -S server;SCREEN -S client"

Author

Frank Bergmann, http://www.tuxad.com


Table of Contents