.\" .\" Copyright (c) 1986, 1994, 1996, 2000, 2002 .\" Jeff Forys (jeffware@marjum.com). All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that: (1) Redistributions of .\" source code must retain the above copyright notice, this list of .\" conditions and the following disclaimer, (2) Redistributions in .\" binary form must reproduce the above copyright notice, this list .\" of conditions and the following disclaimer in the documentation .\" and/or other materials provided with the distribution, (3) All .\" advertising materials mentioning features or use of this software .\" must display the following acknowledgment: ``This product includes .\" software developed by Jeff Forys (jeffware@marjum.com).'', (4) .\" The name of the author may not be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. .\" .\" $Id: skill.1,v 1.21 2005/04/06 23:43:34 forys Exp $ .\" .\" skill - send signals to processes by tty, user name, command or proc id. .\" skill - reprioritize processes by tty, user name, command or proc id. .\" .TH SKILL 1 "April 6, 2005" "" "Local UNIX Programmer's Manual" .UC 4 .SH NAME skill, snice \- signal or reprioritize specified processes .SH SYNOPSIS .B skill [\-signal] [\-afinvw] {tty user command pid} .br .B snice [(\-\||\|+)priority] [\-afinvw] {tty user command pid} .br .B skill \-l .SH DESCRIPTION .I Skill sends the .I terminate signal to a set of processes. If a signal name (or number) preceded by a `-' is given, that signal will be substituted for terminate. The command .I `skill -l' displays a list of available signals. .PP .I Snice alters the scheduling priority of selected processes. By default, the new priority is .I +4, but an argument of the form `+N' (or `-N') can be used to specify some other value. Since the meaning of "priority" differs wildly, .I snice will normalize priorities to the range PRIO_MIN through PRIO_MAX; generally `-20' is the highest priority and `+20' is the (s)lowest. Apart from the super-user, users may only increment their priority. An invalid priority is quietly rounded up or down to the first acceptable value. Where multiple scheduling classes are available, .I snice is only guaranteed to operate on processes in the "Time Share" class. .PP Options accepted by both commands are as follows: .IP \-a When run by an unprivileged user, processes that belong to other users are quietly ignored. In all mode, this internal filter is disabled. It may be used in conjunction with the `-n' flag to display a set of processes that match a specified criteria. This flag has no effect for the super-user. .IP \-f In fast mode, the machine-dependent code responsible for reading processes is allowed to make decisions to improve speed at the expense of error reporting (e.g. commands may not be displayed). This option mainly exists to aid in killing runaway processes on operating systems with complicated virtual memory designs. .IP \-i In interactive mode, the user is prompted with each process that is a candidate for action. Responding `y' will carry out the stated action. Also, a ^D at this prompt causes .I skill or .I snice to exit immediately. .IP \-n Display process id's but do .I not act on them. .IP \-v In verbose mode, the id of each process successfully acted upon is displayed. Verbose mode may be enabled by default by setting the "\fBSKILL_VERBOSE\fP" environment variable. .br Alternately, when this is the only argument, version information is displayed and the program exits. .IP \-w Display warning messages for unreachable processes. .PP All command line arguments are order independent. .I Skill and .I snice allow processes to be specified using any combination of ttys, user names, and commands (as well as process id's). Only processes that match something in each category are acted upon. An empty category guarantees a match. For example, `skill -HUP vi ex tty00' will send the .I hangup signal to all .I vi(1) and .I ex(1) processes associated with .I tty00. Similarly, `snice +10 find root' will change the priority of all .I find(1) processes owned by .I root to .I +10. .PP Unprivileged users can only change their own processes so they need .B not specify their user name as part of the argument list. On the other hand, the super-user should be more careful (e.g. the command `snice -5 vi' will change the priority of .B every vi(1) process on the system). .PP Since .I skill and .I snice categorize their arguments, there is a chance that they will do so incorrectly (e.g. a system command is also a user name). Both programs try to match an argument with a .I tty, a .I user name, and a .I process id, before classifying it as a .I command. To override this, an argument can be .B forced to a particular type by preceding it with `-c' (command), `-u' (user), `-t' (tty), or `-p' (process id). As a special case, a question mark (`?') is categorized as a tty, and will match processes without controlling ttys. .PP When targeting processes by command name, both .I skill and .I snice use the actual name of the binary (i.e. that which is used for accounting purposes). Otherwise, as processes are permitted to change their argument vector (specifically argv[0]), an errant program could continually change its name to avoid being acted upon. When targeting a process that has changed its name, use the `-nv' options to see its actual name. Command names may be specified using regular expressions by enclosing them in forward slashes. For example, `skill -KILL /d$/' will send the .I kill signal to processes with names ending in "\fId\fP". .PP Process id's are not known beforehand, so both kernel memory and the swap device must be searched for the required information. Alternately, on some systems, the "/proc" file system is examined. When a process fitting each category is discovered, it is immediately acted upon (unless running in interactive or display-only mode). Processes must belong to the current user unless said user is the super-user. Neither program will ever act on itself, but everything else is fair game. .PP Exit status is normally 0; if the user makes a mistake, 1 is returned. If a system error occurs, exit status is 2. .SH "FILES" /vmunix system name list .br /dev/mem physical memory .br /dev/kmem kernel virtual memory .br /dev/drum swap device .br /proc process file system .br /dev searched to map ttys into device numbers .SH "SEE ALSO" kill(1), nice(1), priocntl(1), renice(1), ps(1), .br kill(2), setpriority(2), signal(2), regex(3), proc(4) .SH "AUTHOR" Jeff Forys .SH "CONTRIBUTORS" David Sharnoff Greg Earle Christos Zoulas .br Gorodecki Tom Mike Hibler Ric Anderson .br Chuck L Blake Lee Duncan Allan E Johannesen .br Michael Smith Aaron Denney Simon Burge .SH "BUGS" Things change while these programs execute, occasionally processes will be missed (the `-w' flag displays these). .sp Systems generally truncate command names to an OS-dependent size. To target commands with long names, specify the truncated name or use a regular expression. .sp On some operating systems, these programs are unable to investigate processes belonging to other users. While not a problem, this fact is reflected in the "(but N could not be checked)" notice, which follows the "no matching processes" message.