about summary refs log tree commit diff
path: root/reap.1
blob: fe51f96458ee2874c2e846821b972b1265e52560 (plain) (blame)
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
.Dd September 23, 2019
.Dt REAP 1
.Os
.Sh NAME
.Nm reap
.Nd run process until all its spawned processes are dead
.Sh SYNOPSIS
.Nm
.Op Fl vwx
.Ar command\ line ...
.Sh DESCRIPTION
The
.Nm
utility executes the given command line and ensures
all spawned processes are dead before it exits.
.Pp
By default, it will start slaying the spawned processes
when the main process exits.
When the option
.Fl w
is given,
.Nm
will instead wait for the processes to terminate.
.Pp
Upon receiving
.Dv SIGINT
or
.Dv SIGTERM ,
.Nm
will start slaying all children immediately.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl v
Verbose mode, report what
.Nm
is doing.
.It Fl w
Wait for all spawned processes to finish.
.It Fl x
Forbid execution of binaries we cannot kill (using
.Dv PR_SET_NO_NEW_PRIVS ) .
.El
.Sh EXIT STATUS
The
.Nm
utility exits with the exit status of the spawned command.
.Pp
On fatal errors, exit codes 111 is returned.
.Sh ASSUMPTIONS
.Nm
uses the
.Dv PR_SET_CHILD_SUBREAPER
feature of Linux.
Slaying the children only works when
the kernel configuration
.Dv CONFIG_PROC_CHILDREN
is enabled.
.Pp
.Nm
can only work reliably when it has permission to kill all spawned
processes and they respect
.Dv SIGTERM
.Pq see also Fl x .
.Sh RATIONALE
Keeping track of all spawned process is traditionally a hard problem
on Unix systems, mainly due to daemonization by forking twice.
.Pp
Other approaches on Linux exist, such as cgroups or PID namespaces.
The approach taken by
.Nm
has the benefit of requiring no special permissions.
.Sh AUTHORS
.An Leah Neukirchen Aq Mt leah@vuxu.org
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law,
the creator of this work
has waived all copyright and related or
neighboring rights to this work.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/