# $Id: sample.ini,v 1.8 2003/03/04 02:53:48 rockyb Exp $ # Comments start with # or ; and go to the end of the line. # The format for each entry is in Microsoft .INI form: # [process-pattern] # trigger = perl-expression # occurs = (every|first|none) # action = program-and-arguments-to-run # "trigger" and "occurs" are optional. # Are there enough (at least 4) httpd processes running? [httpd$] trigger = $count < 4 action = echo "$trigger fired -- You have $count $command sessions." # Show how many processes are running. Use builtin $count # variable [.] action = echo "You have $count processes running" # The below is implied #occurs=first # Which processes have been running for more than 1 day? # Note this hack to specify a pattern ostensibly different from # the above pattern. This is an IniConf-imposed limitation. # Also note use of builtin-function elapsed2secs # and builtin constant DAYS. # The variable $etime (elapsed time) does not exist on your OS. # For on FreeBSD it doesn't, but that has a "cputime" reports a time # entry. [.?] trigger = elapsed2secs('$etime') > 1*DAYS action = echo "$command has been running more than 1 day ($etime)" occurs = every [^] trigger = $vsz > 8000 occurs = every action = echo "Large program $command (pid $pid) matches /$ps_pat/: $vsz KB" # Scripts don't show as the script name as the command name on some # operating systems. Rather the name of the interpreter is listed # (e.g. bash or perl) Here's how you can match against a script. Note # escaping $ in the trigger but not the action. # Note: BSD/OS on the other hand give the script name rather than the # interpreter name. [/usr/bin/perl] trigger = \$args !~ /ps-watcher/ occurs = every action = echo "***found perl program ${pid}:\n $args"