chpst.8.html (5985B)
1 2 3 4 <html> 5 <head> 6 <title>chpst(8) manual page</title> 7 </head> 8 <body bgcolor='white'> 9 <a href='http://smarden.org/pape/'>G. Pape</a><br><a href='index.html'>runit</A><hr><p> 10 11 <h2><a name='sect0'>Name</a></h2> 12 chpst - runs a program with a changed process state 13 <h2><a name='sect1'>Synopsis</a></h2> 14 <b>chpst</b> [-vP012] 15 [-u <i>user</i>] [-U <i>user</i>] [-b <i>argv0</i>] [-e <i>dir</i>] [-/ <i>root</i>] [-n <i>inc</i>] [-l|-L <i>lock</i>] [-m <i>bytes</i>] [-d <i>bytes</i>] 16 [-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c <i>bytes</i>] <i>prog</i> 17 <h2><a name='sect2'>Description</a></h2> 18 <i>prog</i> consists of one or 19 more arguments. <p> 20 <b>chpst</b> changes the process state according to the given options, 21 and runs <i>prog</i>. 22 <h2><a name='sect3'>Options</a></h2> 23 24 <dl> 25 26 <dt><b>-u <i>[:]user[:group]</b> </i></dt> 27 <dd>setuidgid. Set uid and gid to the 28 <i>user</i>’s uid and gid, as found in <i>/etc/passwd</i>. If <i>user</i> is followed by a colon 29 and a <i>group</i>, set the gid to <i>group</i>’s gid, as found in <i>/etc/group</i>, instead 30 of <i>user</i>’s gid. If <i>group</i> consists of a colon-separated list of group names, 31 <b>chpst</b> sets the group ids of all listed groups. If <i>user</i> is prefixed with 32 a colon, the <i>user</i> and all <i>group</i> arguments are interpreted as uid and gids 33 respectivly, and not looked up in the password or group file. All initial 34 supplementary groups are removed. </dd> 35 36 <dt><b>-U <i>[:]user[:group]</b> </i></dt> 37 <dd>envuidgid. Set the environment 38 variables $UID and $GID to the <i>user</i>’s uid and gid, as found in <i>/etc/passwd</i>. 39 If <i>user</i> is followed by a colon and a <i>group</i>, set $GID to the <i>group</i>’s gid, 40 as found in <i>/etc/group</i>, instead of <i>user</i>’s gid. If <i>user</i> is prefixed with a 41 colon, the <i>user</i> and <i>group</i> arguments are interpreted as uid and gid respectivly, 42 and not looked up in the password or group file. </dd> 43 44 <dt><b>-b <i>argv0</b> </i></dt> 45 <dd>argv0. Run <i>prog</i> 46 with <i>argv0</i> as the 0th argument. </dd> 47 48 <dt><b>-e <i>dir</b> </i></dt> 49 <dd>envdir. Set various 50 environment variables as specified by files in the directory <i>dir</i>: If <i>dir</i> 51 contains a file named <i>k</i> whose first line is <i>v</i>, <b>chpst</b> removes the environment 52 variable <i>k</i> if it exists, and then adds the environment variable <i>k</i> with 53 the value <i>v</i>. The name <i>k</i> must not contain =. Spaces and tabs at the end of 54 <i>v</i> are removed, and nulls in <i>v</i> are changed to newlines. If the file <i>k</i> is 55 empty (0 bytes long), <b>chpst</b> removes the environment variable <i>k</i> if it exists, 56 without adding a new variable. </dd> 57 58 <dt><b>-/ <i>root</b> </i></dt> 59 <dd>chroot. Change the root directory to 60 <i>root</i> before starting <i>prog</i>. </dd> 61 62 <dt><b>-n <i>inc</b> </i></dt> 63 <dd>nice. Add <i>inc</i> to the <i><b>nice</b>(2)</i> value before 64 starting <i>prog</i>. <i>inc</i> must be an integer, and may start with a minus or plus. 65 </dd> 66 67 <dt><b>-l <i>lock</b> </i></dt> 68 <dd>lock. Open the file <i>lock</i> for writing, and obtain an exclusive lock 69 on it. <i>lock</i> will be created if it does not exist. If <i>lock</i> is locked by another 70 process, wait until a new lock can be obtained. </dd> 71 72 <dt><b>-L <i>lock</b> </i></dt> 73 <dd>The same as -l, but 74 fail immediately if <i>lock</i> is locked by another process. </dd> 75 76 <dt><b>-m <i>bytes</b> </i></dt> 77 <dd>limit memory. 78 Limit the data segment, stack segment, locked physical pages, and total 79 of all segment per process to <i>bytes</i> bytes each. </dd> 80 81 <dt><b>-d <i>bytes</b> </i></dt> 82 <dd>limit data segment. 83 Limit the data segment per process to <i>bytes</i> bytes. </dd> 84 85 <dt><b>-o <i>n</b> </i></dt> 86 <dd>limit open files. 87 Limit the number of open file descriptors per process to <i>n</i>. </dd> 88 89 <dt><b>-p <i>n</b> </i></dt> 90 <dd>limit processes. 91 Limit the number of processes per uid to <i>n</i>. </dd> 92 93 <dt><b>-f <i>bytes</b> </i></dt> 94 <dd>limit output size. Limit 95 the output file size to <i>bytes</i> bytes. </dd> 96 97 <dt><b>-c <i>bytes</b> </i></dt> 98 <dd>limit core size. Limit the core 99 file size to <i>bytes</i> bytes. </dd> 100 101 <dt><b>-v</b> </dt> 102 <dd>verbose. Print verbose messages to standard error. 103 This includes warnings about limits unsupported by the system. </dd> 104 105 <dt><b>-P</b> </dt> 106 <dd>pgrphack. 107 Run <i>prog</i> in a new process group. </dd> 108 109 <dt><b>-0</b> </dt> 110 <dd>Close standard input before starting 111 <i>prog</i>. </dd> 112 113 <dt><b>-1</b> </dt> 114 <dd>Close standard output before starting <i>prog</i>. </dd> 115 116 <dt><b>-2</b> </dt> 117 <dd>Close standard error 118 before starting <i>prog</i>. </dd> 119 </dl> 120 121 <h2><a name='sect4'>Exit Codes</a></h2> 122 <b>chpst</b> exits 100 when called with wrong options. 123 It prints an error message and exits 111 if it has trouble changing the 124 process state. Otherwise its exit code is the same as that of <i>prog</i>. 125 <h2><a name='sect5'>Emulation</a></h2> 126 If 127 <b>chpst</b> is called as <b>envdir</b>, <b>envuidgid</b>, <b>pgrphack</b>, <b>setlock</b>, <b>setuidgid</b>, or 128 <b>softlimit</b>, it emulates the functionality of these programs from the daemontools 129 package respectively. 130 <h2><a name='sect6'>See Also</a></h2> 131 <i>sv(8)</i>, <i>runsv(8)</i>, <i>setsid(2)</i>, <i>runit(8)</i>, <i>runit-init(8)</i>, 132 <i>runsvdir(8)</i>, <i>runsvchdir(8)</i> <p> 133 <i>http://smarden.org/runit/</i><br> 134 <i>http://cr.yp.to/daemontools.html</i><br> 135 136 <h2><a name='sect7'>Author</a></h2> 137 Gerrit Pape <pape@smarden.org> <p> 138 139 <hr><p> 140 <a name='toc'><b>Table of Contents</b></a><p> 141 <ul> 142 <li><a name='toc0' href='#sect0'>Name</a></li> 143 <li><a name='toc1' href='#sect1'>Synopsis</a></li> 144 <li><a name='toc2' href='#sect2'>Description</a></li> 145 <li><a name='toc3' href='#sect3'>Options</a></li> 146 <li><a name='toc4' href='#sect4'>Exit Codes</a></li> 147 <li><a name='toc5' href='#sect5'>Emulation</a></li> 148 <li><a name='toc6' href='#sect6'>See Also</a></li> 149 <li><a name='toc7' href='#sect7'>Author</a></li> 150 </ul> 151 </body> 152 </html>