killall(ADM)


killall -- kill all active processes

Syntax

/etc/killall [ -c [ -n ] | -v ] [ -p PID[,PID ...] ] [ -t timeout ] [ signal ]

Description

The killall command is used by /etc/rc0 during shutdown to kill active processes so that all mounted filesystems can be unmounted cleanly. By default, all processes are killed except:

If specified, signal is sent to the processes to be killed. The default signal is 9 (SIGKILL).

killall accepts the following options:


-c
Print the number of processes that were specified to be killed but which are still active when killall exits. This number is written to the standard output. This option is intended for use by shutdown scripts to determine if any of the specified processes remain alive.

-n
Do not send any signal to the specified processes. This option is used with the -c option to determine if any of the specified processes are still active.

-p PID[,PID ...]
Send a signal only to those processes with the specified process IDs.

-t timeout
Wait for timeout seconds for all killed processes to die. The default action of killall is to send a signal and exit immediately.

-v
Print statistics on the standard output about processes being killed, unkillable processes, and processes which will not die.

killall should be used in shutdown scripts as a replacement for a kill(C) followed by a sleep(C).

Exit values

killall exits with a value of 0 if successful; it exits with a value of 255 if the time-out expires. Other exit values correspond to errno values defined in /usr/include/sys/errno.h.

Examples

Test whether processes with PIDs 10, 20, and 30 still exist:
   nprocs=`/etc/killall -c -n -p 10,20,30`
   

[ $nprocs != 0 ] && echo "$nprocs processes are still alive"

Send signal 15 (SIGTERM) to processes with PIDs 10, 20, and 30; wait for up to ten seconds for them to exit:
   killall -t 10 -p 10,20,30 15
The following script sends SIGTERM to allow processes to die gracefully over a ten second period. If the processes are still active, SIGKILL is sent and killall waits for a further ten seconds:
   nprocs=`/etc/killall -c -p $pid -t 10 15`
   

if [ $nprocs != 0 ] then # processes still active, try using SIGKILL instead nprocs=`/etc/killall -c -p $pid -t 10` [ $nprocs != 0 ] && echo "$nprocs processes are still alive" fi

Authorization

Only root can run killall.

See also

kill(C), ps(C), rc0(ADM), shutdown(ADM), ,signal(S-osr5) sleep(C)

Standards conformance

killall is conformant with AT&T SVID Issue 2.

killall includes extended functionality provided by The Santa Cruz Operation, Inc.


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005