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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
.TH chpst 8
.SH NAME
chpst \- runs a program with a changed process state
.SH SYNOPSIS
.B chpst
[\-vP012]
[\-u
.IR user ]
[\-U
.IR user ]
[-e
.IR dir ]
[-l|-L
.IR lock ]
[-m
.IR bytes ]
[-o
.IR n ]
[-p
.IR n ]
[-f
.IR bytes ]
[-c
.IR bytes ]
.I prog
.SH DESCRIPTION
.I prog
consists of one or more arguments.
.P
.B chpst
changes the process state according to the given options, and runs
.IR prog .
.SH OPTIONS
.TP
.B \-u \fIuser[:group]
setuidgid.
Set uid and gid to the
.IR user 's
uid and gid.
If
.I user
is followed by a colon and a
.IR group ,
set the gid to
.IR group 's
gid instead of
.IR user 's
gid.
All supplementary groups are removed.
.TP
.B \-U \fIuser[:group]
envuidgid.
Set the environment variables $UID and $GID to the
.IR user 's
uid and gid.
If
.I user
is followed by a colon and a
.IR group ,
set $GID to the
.IR group 's
gid instead of
.IR user 's
gid.
.TP
.B \-e \fIdir
envdir.
Set various environment variables as specified by files in the directory
.IR dir :
If
.I dir
contains a file named
.I k
whose first line is
.IR v ,
.B chpst
removes the environment variable
.I k
if it exists, and then adds the environment variable
.I k
with the value
.IR v .
The name
.I k
must not contain =.
Spaces and tabs at the end of
.I v
are removed, and nulls in
.I v
are changed to newlines.
If the file
.I k
is empty (0 bytes long),
.B chpst
removes the environment variable
.I k
if it exists, without adding a new variable.
.TP
.B \-l \fIlock
lock.
Open the file
.I lock
for writing, and obtain an exclusive lock on it.
.I lock
will be created if it does not exist.
If
.I lock
is locked by another process, wait until a new lock can be obtained.
.TP
.B \-L \fIlock
The same as \-l, but fail immediately if
.I lock
is locked by another process.
.TP
.B \-m \fIbytes
limit memory.
Limit the data segment, stack segment, locked physical pages, and total of
all segment per process to
.I bytes
bytes each.
.TP
.B \-o \fIn
limit open files.
Limit the number of open file descriptors per process to
.IR n .
.TP
.B \-p \fIn
limit processes.
Limit the number of processes per uid to
.IR n .
.TP
.B \-f \fIbytes
limit output size.
Limit the output file size to
.I bytes
bytes.
.TP
.B \-c \fIbytes
limit core size.
Limit the core file size to
.I bytes
bytes.
.TP
.B \-v
verbose.
Print warnings about limits unsupported by the system to standard error.
.TP
.B \-P
pgrphack.
Run
.I prog
in a new process group.
.TP
.B \-0
Close standard input before running
.IR prog .
.TP
.B \-1
Close standard output before running
.IR prog .
.TP
.B \-2
Close standard error before running
.IR prog .
.SH EXIT CODES
.B chpst
exits 100 when called with wrong options.
It prints an error message and exits 111 if it has trouble changing the
process state.
Otherwise its exit code is the same as that of
.IR prog .
.SH EMULATION
If
.B chpst
is called as
.BR envdir (8),
.BR envuidgid (8),
.BR pgrphack (8),
.BR setlock (8),
.BR setuidgid (8),
or
.BR softlimit (8),
it emulates the functionality of these programs from the daemontools package
respectively.
.SH SEE ALSO
runsv(8),
runsvctrl(8),
runsvstat(8),
runsvdir(8),
setsid(2)
.P
http://smarden.org/runit/
http://cr.yp.to/daemontools.html
.SH AUTHOR
Gerrit Pape <pape@smarden.org>
|