1ctrun(1) User Commands ctrun(1)
2
3
4
6 ctrun - execute command in a process contract
7
9 /usr/bin/ctrun [options] command [ argument]...
10
11
13 The ctrun utility starts a command in a newly created process contract.
14 ctrun holds the contract and can be instructed to output or respond to
15 events that occur within the contract.
16
17
18 For additional information about process contracts, see contract(4) and
19 process(4).
20
22 The following options are supported:
23
24 -A fmri aux Sets the process contract creator's auxiliary
25 field.
26
27
28 -i event,[event ...] Sets the informative and fatal events,
29 -f event,[event ...] respectively.
30
31 The following are valid events:
32
33 core A member process dumped core.
34
35 core events are informative by
36 default.
37
38
39 empty The last member of the process con‐
40 tract exited.
41
42
43 exit A member process exited.
44
45
46 fork A process was added to the process
47 contract.
48
49
50 hwerr A member process encountered a
51 hardware error.
52
53 hwerr events are fatal by default.
54
55
56 signal A member process received a fatal
57 signal from a process in a differ‐
58 ent process contract.
59
60 Only core, hwerr, and signal events can be
61 made fatal.
62
63 More events can be delivered than requested
64 if ctrun requires them for its own purposes.
65 For example, empty messages are always
66 requested if a lifetime of contract is speci‐
67 fied. See -l.
68
69
70 -F fmri Sets the process contract service FMRI field.
71 To set this field the caller is required to
72 have the {PRIV_CONTRACT_IDENTITY} in its
73 effective set.
74
75
76 -l lifetime The following valid lifetime values are sup‐
77 ported:
78
79 child ctrun exits when the command
80 exits, regardless of whether the
81 contract is empty.
82
83
84 contract ctrun exits only when the con‐
85 tract exits. This is the default.
86
87
88 none ctrun exits immediately, orphan‐
89 ing the contract.
90
91
92
93 -o option,[option ...] The following options are supported:
94
95 noorphan Kills all processes in the con‐
96 tract if the holder (ctrun)
97 exits.
98
99 This option is invalid when a
100 lifetime of none is specified.
101
102
103 pgrponly If a fatal error occurs, kills at
104 most the process group of which
105 the errant process is a member.
106
107
108 regent The contract inherits inheritable
109 contracts when abandoned by mem‐
110 ber processes.
111
112
113
114 -r count If the contract encounters a fault, this
115 option attempts to restart the command count
116 times. If count is 0, the attempt to restart
117 continues indefinitely. By default, ctrun
118 does not attempt to restart the command.
119
120 This option is invalid if a lifetime other
121 than contract is specified or if the pgrponly
122 option is used.
123
124
125 -t If the contract created by ctrun inherited
126 subcontracts from its member processes,
127 attempts to transfer them to the new contract
128 when restarting.
129
130 This option is invalid unless -r is also
131 specified.
132
133
134 -v Displays contract events and ctrun actions as
135 they occur.
136
137
138 -V Displays verbose contract events, as are dis‐
139 played by the -v option of ctwatch. Implies
140 -v.
141
142
144 The following operands are supported:
145
146 argument One of the strings treated as an argument to command.
147
148
149 command The command to be passed to execvp(2). See exec(2).
150
151
153 Example 1 Running a Shell in a New Process Contract
154
155
156 The following example runs a shell in a new process contract:
157
158
159 example% ctrun -l child -o pgrponly ksh
160
161
162
163
164 The -l child option argument is specified so that ctrun won't wait
165 until all children of the shell have exited. -o pgrponly is specified
166 because an interactive ksh puts each job in a new process group, and an
167 error in one job is unlikely to affect the others.
168
169
170 Example 2 Running a Simple Server
171
172
173 The following example runs a simple server:
174
175
176 example% ctrun -r 0 -t -f hwerr,core,signal server
177
178
179
180
181 The -r 0 and -t options are specified to indicate that if the server
182 encounters a fatal error, ctrun should try to restart it. The -f option
183 makes "hwerr", "core", and "signal" fatal events.
184
185
187 If command is specified and successfully invoked (see exec(2)), the
188 exit status of ctrun is the exit status of command. Otherwise, ctrun
189 exits with one of the following values:
190
191 123 The child process exited abnormally.
192
193
194 124 ctrun encountered an internal error.
195
196
197 125 Invalid arguments were provided to ctrun.
198
199
200 126 command was found but could not be invoked.
201
202
203 127 command could not be found.
204
205
207 /system/contract/process/*
208
209
211 See attributes(5) for descriptions of the following attributes:
212
213
214
215
216 ┌─────────────────────────────┬─────────────────────────────┐
217 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
218 ├─────────────────────────────┼─────────────────────────────┤
219 │Availability │SUNWcsu │
220 ├─────────────────────────────┼─────────────────────────────┤
221 │Interface Stability │See below. │
222 └─────────────────────────────┴─────────────────────────────┘
223
224
225 Human Readable Output is Uncommitted. Invocation is Committed.
226
228 ctstat(1), ctwatch(1), exec(2), contract(4), process(4), attributes(5)
229
230
231
232SunOS 5.11 25 Feb 2008 ctrun(1)