chpst.8 (4474B)
1 .TH chpst 8 2 .SH NAME 3 chpst \- runs a program with a changed process state 4 .SH SYNOPSIS 5 .B chpst 6 [\-vP012] 7 [\-u 8 .IR user ] 9 [\-U 10 .IR user ] 11 [\-b 12 .IR argv0 ] 13 [-e 14 .IR dir ] 15 [\-/ 16 .IR root ] 17 [\-n 18 .IR inc ] 19 [-l|-L 20 .IR lock ] 21 [-m 22 .IR bytes ] 23 [-d 24 .IR bytes ] 25 [-o 26 .IR n ] 27 [-p 28 .IR n ] 29 [-f 30 .IR bytes ] 31 [-c 32 .IR bytes ] 33 .I prog 34 .SH DESCRIPTION 35 .I prog 36 consists of one or more arguments. 37 .P 38 .B chpst 39 changes the process state according to the given options, and runs 40 .IR prog . 41 .SH OPTIONS 42 .TP 43 .B \-u \fI[:]user[:group] 44 setuidgid. 45 Set uid and gid to the 46 .IR user 's 47 uid and gid, as found in 48 .IR /etc/passwd . 49 If 50 .I user 51 is followed by a colon and a 52 .IR group , 53 set the gid to 54 .IR group 's 55 gid, as found in 56 .IR /etc/group , 57 instead of 58 .IR user 's 59 gid. 60 If 61 .I group 62 consists of a colon-separated list of group names, 63 .B chpst 64 sets the group ids of all listed groups. 65 If 66 .I user 67 is prefixed with a colon, the 68 .I user 69 and all 70 .I group 71 arguments are interpreted as uid and gids respectivly, and not looked up in 72 the password or group file. 73 All initial supplementary groups are removed. 74 .TP 75 .B \-U \fI[:]user[:group] 76 envuidgid. 77 Set the environment variables $UID and $GID to the 78 .IR user 's 79 uid and gid, as found in 80 .IR /etc/passwd . 81 If 82 .I user 83 is followed by a colon and a 84 .IR group , 85 set $GID to the 86 .IR group 's 87 gid, as found in 88 .IR /etc/group , 89 instead of 90 .IR user 's 91 gid. 92 If 93 .I user 94 is prefixed with a colon, the 95 .I user 96 and 97 .I group 98 arguments are interpreted as uid and gid respectivly, and not looked up in 99 the password or group file. 100 .TP 101 .B \-b \fIargv0 102 argv0. 103 Run 104 .I prog 105 with 106 .I argv0 107 as the 0th argument. 108 .TP 109 .B \-e \fIdir 110 envdir. 111 Set various environment variables as specified by files in the directory 112 .IR dir : 113 If 114 .I dir 115 contains a file named 116 .I k 117 whose first line is 118 .IR v , 119 .B chpst 120 removes the environment variable 121 .I k 122 if it exists, and then adds the environment variable 123 .I k 124 with the value 125 .IR v . 126 The name 127 .I k 128 must not contain =. 129 Spaces and tabs at the end of 130 .I v 131 are removed, and nulls in 132 .I v 133 are changed to newlines. 134 If the file 135 .I k 136 is empty (0 bytes long), 137 .B chpst 138 removes the environment variable 139 .I k 140 if it exists, without adding a new variable. 141 .TP 142 .B \-/ \fIroot 143 chroot. 144 Change the root directory to 145 .I root 146 before starting 147 .IR prog . 148 .TP 149 .B \-C \fIpwd 150 chdir. 151 Change the working directory to 152 .I pwd 153 before starting 154 .IR prog . 155 When combined with \-/, the working directory is changed after the chroot. 156 .TP 157 .B \-n \fIinc 158 nice. 159 Add 160 .I inc 161 to the 162 .BR nice (2) 163 value before starting 164 .IR prog . 165 .I inc 166 must be an integer, and may start with a minus or plus. 167 .TP 168 .B \-l \fIlock 169 lock. 170 Open the file 171 .I lock 172 for writing, and obtain an exclusive lock on it. 173 .I lock 174 will be created if it does not exist. 175 If 176 .I lock 177 is locked by another process, wait until a new lock can be obtained. 178 .TP 179 .B \-L \fIlock 180 The same as \-l, but fail immediately if 181 .I lock 182 is locked by another process. 183 .TP 184 .B \-m \fIbytes 185 limit memory. 186 Limit the data segment, stack segment, locked physical pages, and total of 187 all segment per process to 188 .I bytes 189 bytes each. 190 .TP 191 .B \-d \fIbytes 192 limit data segment. 193 Limit the data segment per process to 194 .I bytes 195 bytes. 196 .TP 197 .B \-o \fIn 198 limit open files. 199 Limit the number of open file descriptors per process to 200 .IR n . 201 .TP 202 .B \-p \fIn 203 limit processes. 204 Limit the number of processes per uid to 205 .IR n . 206 .TP 207 .B \-f \fIbytes 208 limit output size. 209 Limit the output file size to 210 .I bytes 211 bytes. 212 .TP 213 .B \-c \fIbytes 214 limit core size. 215 Limit the core file size to 216 .I bytes 217 bytes. 218 .TP 219 .B \-v 220 verbose. 221 Print verbose messages to standard error. 222 This includes warnings about limits unsupported by the system. 223 .TP 224 .B \-P 225 pgrphack. 226 Run 227 .I prog 228 in a new process group. 229 .TP 230 .B \-0 231 Close standard input before starting 232 .IR prog . 233 .TP 234 .B \-1 235 Close standard output before starting 236 .IR prog . 237 .TP 238 .B \-2 239 Close standard error before starting 240 .IR prog . 241 .SH EXIT CODES 242 .B chpst 243 exits 100 when called with wrong options. 244 It prints an error message and exits 111 if it has trouble changing the 245 process state. 246 Otherwise its exit code is the same as that of 247 .IR prog . 248 .SH EMULATION 249 If 250 .B chpst 251 is called as 252 .BR envdir , 253 .BR envuidgid , 254 .BR pgrphack , 255 .BR setlock , 256 .BR setuidgid , 257 or 258 .BR softlimit , 259 it emulates the functionality of these programs from the daemontools package 260 respectively. 261 .SH SEE ALSO 262 sv(8), 263 runsv(8), 264 setsid(2), 265 runit(8), 266 runit-init(8), 267 runsvdir(8), 268 runsvchdir(8) 269 .P 270 http://smarden.org/runit/ 271 http://cr.yp.to/daemontools.html 272 .SH AUTHOR 273 Gerrit Pape <pape@smarden.org>