1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
nkillall(8) nkillall(8)
NAME
nkillall - send signals to all processes; write messages to users
SYNOPSIS
nkillall -[vq] [-s secs] [-M|W mesg] [-signum] [-E prog [arg[s]]
DESCRIPTION
nkillall sends signals to all processes skipping it's own PID. It is a
simple program that does not use /proc FS. It uses kill(2) and
execve(2) syscalls. It is designed as a replacement of the SysVinit
killall5(8) command.
USAGE
It is not allowed to use -h (signal SIGHUP) as first option! If you
really want this then start: nkillall -s0 -hup ...
-v verbose mode; -vv means more verbose
-q quiet mode; ignores SIGINT signal; Ctrl-C does't work!
-s secs
sleep secs
-M mesg
write mesg to stdout. The message can include escape symbols:
\NNN, \a, \b, \e, \c, \f, \n, \r, \t, \v, \\ like in C language.
Last message can be written again with -M% or -W%. Example:
nkillall -M'\n\aPlease logout! The system is going down...' \
-W% -s2 -W% -s4 -W% -s12 \
-M'\tSending TERM signal' -term ...
-W mesg
write mesg to all logged users. The syntax is the same as -M.
nkillall determines logged users by looking at /var/run/utmp.
In my opinion /var/run/utmp is unreliable! Other programs like
who(1), wall(1), login(1) also use this file. If you feel that
yours is insecure, better don't use the -W option.
-signum
send all processes the singal signum. Some important signals
can be encodded. For example SIGTERM can be typed with -15 or
-term. Only the first letter is important! The command kill -l
lists the signal numbers.
-E /path/to/program [arg[s]]
execve(2) the program with some arguments. This option must be
last! The program will have the same PID as nkillall.
NOTE
The options are applied immediately. Their position is important. The
next two examples work differently:
nkillall -q -s2 -M'sending signal SIGTERM' -15 ...
nkillall -s2 -M'sending signal SIGTERM' -15 -q ...
Use the options -v[v] -q after nkillall immediately.
WARNING
nkillall also kills the script in which it is included. Use it in
scripts like:
#!/bin/sh
before commands
exec nkillall [options] -E/path/to/prog prog_opt(s)
An example of wrong usage is the following:
#!/bin/sh
before commands
nkillall ...
after commands
EXAMPLES
nkillall -M'Sending all processes SIGTERM ...' -s2 -15 \
-M'Sending all processes SIGKILL ...' -s6 -9 \
-s1 -E /path/to/program arg1 arg2 ...
nkillall -v -s1 -15 -cont -s6 -kill -s1 -E/path/to/prog arg(s) ...
nkillall -vv -pause -s59 -continue -M'Hello world!'
FILES
/var/run/utmp
AUTHOR
nkillall is included in ninit package and can be downloaded from
http://riemann.frmi.uni-sofia.bg/ninit/
SEE ALSO
ninit(8), kill(1), kill(2), execve(2), utmp(5)
init(8), killall5(8)
Dec 28, 2009 nkillall(8)
|