Linux Training

Linux training for private, public & voluntary sector.

0800 024 8425

City LinUX sample scripts - roguehunter

NAME

roguehunter - identify and terminate rogue processes

SYNOPSIS

roguehunter [ -c <config_file> ] [ -d ] [ -m # ] [ -v ]

AVAILABILITY

roguehunter is a Bourne shell script which should work equally well on all versions of UNIX, Linux and even bloody UnixWare.

DESCRIPTION

The roguehunter is at present server specific. Tests to identify rogue processes are hard coded into the script.

The script attempts to kill processes with SIGHUP in order allow a clean termination. No attempt is made to use SIGKILL if termination fails.

A terse record of the attempted kills are maintained in the log file. /var/log/roguehunter<#>.

OPTIONS

-c    <configuration_file>

The configuration file is at present unused.

-d    The debug mode echos all actions to standard error.

-m # Set the maximum time in minutes that a process may occupy the CPU before it catches the attention of roguehunter. In the abscence of a -m    option the default maximum time is 50.

-v    Verbose mode, the script will run with the -x    option set.

EXAMPLES

	roguehunter

Identify rogue processes (cpu hogs) on the current host using the criteria hard coded in the script and terminate them.

	roguehunter -d

As above but echo each line to standard error.

FILES

roguehunter.cf.

BUGS

The script has very little input error checking. .SH HISTORY The script was created to deal with extreme process hogs created by Mega on a Caldera Open Unix host. Access to the system is achieved through terminal emulation from PCs. I suspect that the PCs are shutdown without ending the telnet/ssh session and that as a consequence, SIGHUP is never sent to the host. When the telnet session is broken the login process is attached to init and the application process smn12 becomes a process hog. The script therefore is essentially concerned with processor hogs identified as smn12 and the associated ksh login although it could be easily modified to use a config script which identified other target names. Other processes that are identified as a potential problem are added to the log files for further consideration.

AUTHOR

Clifford W Fulford, City Linux. Contact fulford@fulford.net or +44 (0)793 572 8612


The layout and associated style sheets for this page are taken from the World Wide Web Consortium and used here under the W3C software licence.