1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Reference
</title>
6 <link rel=
"stylesheet" href=
"../luadoc.css" type=
"text/css" />
7 <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
14 <div id=
"product_logo"></div>
15 <div id=
"product_name"><big><b></b></big></div>
16 <div id=
"product_description"></div>
17 </div> <!-- id="product" -->
27 <li><a href=
"../index.html">Index
</a></li>
38 <a href=
"../modules/luci.dispatcher.html">luci.dispatcher
</a>
42 <a href=
"../modules/luci.http.html">luci.http
</a>
46 <a href=
"../modules/luci.http.conditionals.html">luci.http.conditionals
</a>
50 <a href=
"../modules/luci.http.date.html">luci.http.date
</a>
54 <a href=
"../modules/luci.http.mime.html">luci.http.mime
</a>
58 <a href=
"../modules/luci.i18n.html">luci.i18n
</a>
62 <a href=
"../modules/luci.ip.html">luci.ip
</a>
66 <a href=
"../modules/luci.ip.cidr.html">luci.ip.cidr
</a>
70 <a href=
"../modules/luci.json.html">luci.json
</a>
74 <a href=
"../modules/luci.jsonc.html">luci.jsonc
</a>
78 <a href=
"../modules/luci.jsonc.parser.html">luci.jsonc.parser
</a>
82 <a href=
"../modules/luci.model.ipkg.html">luci.model.ipkg
</a>
86 <a href=
"../modules/luci.model.uci.html">luci.model.uci
</a>
90 <a href=
"../modules/luci.rpcc.html">luci.rpcc
</a>
94 <a href=
"../modules/luci.rpcc.ruci.html">luci.rpcc.ruci
</a>
98 <a href=
"../modules/luci.sys.html">luci.sys
</a>
102 <a href=
"../modules/luci.sys.init.html">luci.sys.init
</a>
106 <a href=
"../modules/luci.sys.iptparser.html">luci.sys.iptparser
</a>
110 <a href=
"../modules/luci.sys.net.html">luci.sys.net
</a>
113 <li><strong>luci.sys.process
</strong></li>
116 <a href=
"../modules/luci.sys.user.html">luci.sys.user
</a>
120 <a href=
"../modules/luci.sys.wifi.html">luci.sys.wifi
</a>
124 <a href=
"../modules/luci.util.html">luci.util
</a>
128 <a href=
"../modules/nixio.html">nixio
</a>
132 <a href=
"../modules/nixio.CHANGELOG.html">nixio.CHANGELOG
</a>
136 <a href=
"../modules/nixio.CryptoHash.html">nixio.CryptoHash
</a>
140 <a href=
"../modules/nixio.File.html">nixio.File
</a>
144 <a href=
"../modules/nixio.README.html">nixio.README
</a>
148 <a href=
"../modules/nixio.Socket.html">nixio.Socket
</a>
152 <a href=
"../modules/nixio.TLSContext.html">nixio.TLSContext
</a>
156 <a href=
"../modules/nixio.TLSSocket.html">nixio.TLSSocket
</a>
160 <a href=
"../modules/nixio.UnifiedIO.html">nixio.UnifiedIO
</a>
164 <a href=
"../modules/nixio.bin.html">nixio.bin
</a>
168 <a href=
"../modules/nixio.bit.html">nixio.bit
</a>
172 <a href=
"../modules/nixio.crypto.html">nixio.crypto
</a>
176 <a href=
"../modules/nixio.fs.html">nixio.fs
</a>
191 </div><!-- id="navigation" -->
195 <h1>Class
<code>luci.sys.process
</code></h1>
199 LuCI system utilities / process related functions.
209 <table class=
"function_list">
212 <td class=
"name" nowrap
><a href=
"#process.exec">exec
</a> (commend, stdout, stderr, nowait)
</td>
215 Execute a process, optionally capturing stdio.
</td>
219 <td class=
"name" nowrap
><a href=
"#process.info">info
</a> ()
</td>
222 Get the current process id.
</td>
226 <td class=
"name" nowrap
><a href=
"#process.list">list
</a> ()
</td>
229 Retrieve information about currently running processes.
</td>
233 <td class=
"name" nowrap
><a href=
"#process.setgroup">setgroup
</a> (gid)
</td>
236 Set the gid of a process identified by given pid.
</td>
240 <td class=
"name" nowrap
><a href=
"#process.setuser">setuser
</a> (uid)
</td>
243 Set the uid of a process identified by given pid.
</td>
247 <td class=
"name" nowrap
><a href=
"#process.signal">signal
</a> (pid, sig)
</td>
250 Send a signal to a process identified by given pid.
</td>
264 <h2><a name=
"functions"></a>Functions
</h2>
265 <dl class=
"function">
269 <dt><a name=
"process.exec"></a><strong>exec
</strong> (commend, stdout, stderr, nowait)
</dt>
273 Execute a process, optionally capturing stdio.
275 Executes the process specified by the given argv vector, e.g.
276 <code>{
"/bin/sh",
"-c",
"echo 1" }
</code> and waits for it to terminate unless a true
277 value has been passed for the
"nowait" parameter.
279 When a function value is passed for the stdout or stderr arguments, the passed
280 function is repeatedly called for each chunk read from the corresponding stdio
281 stream. The read data is passed as string containing at most
4096 bytes at a
284 When a true, non-function value is passed for the stdout or stderr arguments,
285 the data of the corresponding stdio stream is read into an internal string
286 buffer and returned as
"stdout" or
"stderr" field respectively in the result
289 When a true value is passed to the nowait parameter, the function does not
290 await process termination but returns as soon as all captured stdio streams
291 have been closed or - if no streams are captured - immediately after launching
300 commend: Table containing the argv vector to execute
304 stdout: Callback function or boolean to indicate capturing (optional)
308 stderr: Callback function or boolean to indicate capturing (optional)
312 nowait: Don't wait for process termination when true (optional)
322 <h3>Return value:
</h3>
323 Table containing at least the fields
"code" which holds the exit
324 status of the invoked process or
"-1" on error and
"pid", which
325 contains the process id assigned to the spawned process. When
326 stdout and/or stderr capturing has been requested, it additionally
327 contains
"stdout" and
"stderr" fields respectively, holding the
328 captured stdio data as string.
337 <dt><a name=
"process.info"></a><strong>info
</strong> ()
</dt>
341 Get the current process id.
350 <h3>Return value:
</h3>
351 Number containing the current pid
360 <dt><a name=
"process.list"></a><strong>list
</strong> ()
</dt>
364 Retrieve information about currently running processes.
373 <h3>Return value:
</h3>
374 Table containing process information
383 <dt><a name=
"process.setgroup"></a><strong>setgroup
</strong> (gid)
</dt>
387 Set the gid of a process identified by given pid.
395 gid: Number containing the Unix group id
405 <h3>Return values:
</h3>
408 <li>Boolean indicating successful operation
410 <li>String containing the error message if failed
412 <li>Number containing the error code if failed
423 <dt><a name=
"process.setuser"></a><strong>setuser
</strong> (uid)
</dt>
427 Set the uid of a process identified by given pid.
435 uid: Number containing the Unix user id
445 <h3>Return values:
</h3>
448 <li>Boolean indicating successful operation
450 <li>String containing the error message if failed
452 <li>Number containing the error code if failed
463 <dt><a name=
"process.signal"></a><strong>signal
</strong> (pid, sig)
</dt>
467 Send a signal to a process identified by given pid.
475 pid: Number containing the process id
479 sig: Signal to send (default:
15 [SIGTERM])
489 <h3>Return values:
</h3>
492 <li>Boolean indicating successful operation
494 <li>Number containing the error code if failed
509 </div> <!-- id="content" -->
511 </div> <!-- id="main" -->
514 <p><a href=
"http://validator.w3.org/check?uri=referer"><img src=
"http://www.w3.org/Icons/valid-xhtml10" alt=
"Valid XHTML 1.0!" height=
"31" width=
"88" /></a></p>
515 </div> <!-- id="about" -->
517 </div> <!-- id="container" -->