summary refs log tree commit diff
path: root/doc/chpst.8.html
blob: 69fb925737c5e587fffb1824b0ad9b6fd9112a30 (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
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



<html>
<head>
<title>chpst(8) manual page</title>
</head>
<body bgcolor='white'>
<a href='http://smarden.org/pape/'>G. Pape</a><br><a href='index.html'>runit</A><hr><p>

<h2><a name='sect0'>Name</a></h2>
chpst - runs a program with a changed process state 
<h2><a name='sect1'>Synopsis</a></h2>
<b>chpst</b> [-vP012]
[-u <i>user</i>] [-U <i>user</i>] [-e <i>dir</i>] [-l|-L <i>lock</i>] [-m <i>bytes</i>] [-o <i>n</i>] [-p <i>n</i>] [-f <i>bytes</i>] [-c
<i>bytes</i>] <i>prog</i> 
<h2><a name='sect2'>Description</a></h2>
<i>prog</i> consists of one or more arguments. <p>
<b>chpst</b> changes
the process state according to the given options, and runs <i>prog</i>. 
<h2><a name='sect3'>Options</a></h2>

<dl>

<dt><b>-u
<i>user[:group]</b> </i></dt>
<dd>setuidgid. Set uid and gid to the <i>user</i>&rsquo;s uid and gid. If <i>user</i>
is followed by a colon and a <i>group</i>, set the gid to <i>group</i>&rsquo;s gid instead of
<i>user</i>&rsquo;s gid. All supplementary groups are removed. </dd>

<dt><b>-U <i>user[:group]</b> </i></dt>
<dd>envuidgid.
Set the environment variables $UID and $GID to the <i>user</i>&rsquo;s uid and gid. If
<i>user</i> is followed by a colon and a <i>group</i>, set $GID to the <i>group</i>&rsquo;s gid instead
of <i>user</i>&rsquo;s gid. </dd>

<dt><b>-e <i>dir</b> </i></dt>
<dd>envdir. Set various environment variables as specified
by files in the directory <i>dir</i>: If <i>dir</i> contains a file named <i>k</i> whose first
line is <i>v</i>, <b>chpst</b> removes the environment variable <i>k</i> if it exists, and then
adds the environment variable <i>k</i> with the value <i>v</i>. The name <i>k</i> must not contain
=. Spaces and tabs at the end of <i>v</i> are removed, and nulls in <i>v</i> are changed
to newlines. If the file <i>k</i> is empty (0 bytes long), <b>chpst</b> removes the environment
variable <i>k</i> if it exists, without adding a new variable. </dd>

<dt><b>-l <i>lock</b> </i></dt>
<dd>lock. Open
the file <i>lock</i> for writing, and obtain an exclusive lock on it. <i>lock</i> will
be created if it does not exist. If <i>lock</i> is locked by another process, wait
until a new lock can be obtained. </dd>

<dt><b>-L <i>lock</b> </i></dt>
<dd>The same as -l, but fail immediately
if <i>lock</i> is locked by another process. </dd>

<dt><b>-m <i>bytes</b> </i></dt>
<dd>limit memory. Limit the data
segment, stack segment, locked physical pages, and total of all segment
per process to <i>bytes</i> bytes each. </dd>

<dt><b>-o <i>n</b> </i></dt>
<dd>limit open files. Limit the number of
open file descriptors per process to <i>n</i>. </dd>

<dt><b>-p <i>n</b> </i></dt>
<dd>limit processes. Limit the number
of processes per uid to <i>n</i>. </dd>

<dt><b>-f <i>bytes</b> </i></dt>
<dd>limit output size. Limit the output file
size to <i>bytes</i> bytes. </dd>

<dt><b>-c <i>bytes</b> </i></dt>
<dd>limit core size. Limit the core file size to
<i>bytes</i> bytes. </dd>

<dt><b>-v</b> </dt>
<dd>verbose. Print warnings about limits unsupported by the system
to standard error. </dd>

<dt><b>-P</b> </dt>
<dd>pgrphack. Run <i>prog</i> in a new process group. </dd>

<dt><b>-0</b> </dt>
<dd>Close standard
input before running <i>prog</i>. </dd>

<dt><b>-1</b> </dt>
<dd>Close standard output before running <i>prog</i>. </dd>

<dt><b>-2</b>
</dt>
<dd>Close standard error before running <i>prog</i>. </dd>
</dl>

<h2><a name='sect4'>Exit Codes</a></h2>
<b>chpst</b> 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 <i>prog</i>. 
<h2><a name='sect5'>Emulation</a></h2>
If <b>chpst</b> is called as <i><b>envdir</b>(8)</i>, <i><b>envuidgid</b>(8)</i>,
<i><b>pgrphack</b>(8)</i>, <i><b>setlock</b>(8)</i>, <i><b>setuidgid</b>(8)</i>, or <i><b>softlimit</b>(8)</i>, it emulates the
functionality of these programs from the daemontools package respectively.

<h2><a name='sect6'>See Also</a></h2>
<i>runsv(8)</i>, <i>runsvctrl(8)</i>, <i>runsvstat(8)</i>, <i>runsvdir(8)</i>, <i>setsid(2)</i> <p>
 <i>http://smarden.org/runit/</i><br>
  <i>http://cr.yp.to/daemontools.html</i><br>
 
<h2><a name='sect7'>Author</a></h2>
Gerrit Pape &lt;pape@smarden.org&gt; <p>

<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Options</a></li>
<li><a name='toc4' href='#sect4'>Exit Codes</a></li>
<li><a name='toc5' href='#sect5'>Emulation</a></li>
<li><a name='toc6' href='#sect6'>See Also</a></li>
<li><a name='toc7' href='#sect7'>Author</a></li>
</ul>
</body>
</html>