Merge pull request #4200 from zhanhb/luci-app-acme
[project/luci.git] / docs / api / modules / luci.sys.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html>
4 <head>
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"/-->
8 </head>
9
10 <body>
11 <div id="container">
12
13 <div id="product">
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" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26
27 <li><a href="../index.html">Index</a></li>
28
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37 <li>
38 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39 </li>
40
41 <li>
42 <a href="../modules/luci.http.html">luci.http</a>
43 </li>
44
45 <li>
46 <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
47 </li>
48
49 <li>
50 <a href="../modules/luci.http.date.html">luci.http.date</a>
51 </li>
52
53 <li>
54 <a href="../modules/luci.http.mime.html">luci.http.mime</a>
55 </li>
56
57 <li>
58 <a href="../modules/luci.i18n.html">luci.i18n</a>
59 </li>
60
61 <li>
62 <a href="../modules/luci.ip.html">luci.ip</a>
63 </li>
64
65 <li>
66 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
67 </li>
68
69 <li>
70 <a href="../modules/luci.json.html">luci.json</a>
71 </li>
72
73 <li>
74 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
75 </li>
76
77 <li>
78 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
79 </li>
80
81 <li>
82 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
83 </li>
84
85 <li>
86 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
87 </li>
88
89 <li>
90 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
91 </li>
92
93 <li>
94 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
95 </li>
96
97 <li><strong>luci.sys</strong></li>
98
99 <li>
100 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
101 </li>
102
103 <li>
104 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
105 </li>
106
107 <li>
108 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
109 </li>
110
111 <li>
112 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
113 </li>
114
115 <li>
116 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
117 </li>
118
119 <li>
120 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
121 </li>
122
123 <li>
124 <a href="../modules/luci.util.html">luci.util</a>
125 </li>
126
127 <li>
128 <a href="../modules/luci.xml.html">luci.xml</a>
129 </li>
130
131 <li>
132 <a href="../modules/nixio.html">nixio</a>
133 </li>
134
135 <li>
136 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
137 </li>
138
139 <li>
140 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
141 </li>
142
143 <li>
144 <a href="../modules/nixio.File.html">nixio.File</a>
145 </li>
146
147 <li>
148 <a href="../modules/nixio.README.html">nixio.README</a>
149 </li>
150
151 <li>
152 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
153 </li>
154
155 <li>
156 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
157 </li>
158
159 <li>
160 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
161 </li>
162
163 <li>
164 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
165 </li>
166
167 <li>
168 <a href="../modules/nixio.bin.html">nixio.bin</a>
169 </li>
170
171 <li>
172 <a href="../modules/nixio.bit.html">nixio.bit</a>
173 </li>
174
175 <li>
176 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
177 </li>
178
179 <li>
180 <a href="../modules/nixio.fs.html">nixio.fs</a>
181 </li>
182
183 </ul>
184
185
186
187 <!-- File list -->
188
189
190
191
192
193
194
195 </div><!-- id="navigation" -->
196
197 <div id="content">
198
199 <h1>Class <code>luci.sys</code></h1>
200
201 <p></p>
202
203
204
205
206
207
208
209 <h2>Functions</h2>
210 <table class="function_list">
211
212 <tr>
213 <td class="name" nowrap><a href="#call">call</a>&nbsp;(...)</td>
214 <td class="summary">
215
216 Execute a given shell command and return the error code
217 </td>
218 </tr>
219
220 <tr>
221 <td class="name" nowrap><a href="#dmesg">dmesg</a>&nbsp;()</td>
222 <td class="summary">
223
224 Retrieves the output of the "dmesg" command.</td>
225 </tr>
226
227 <tr>
228 <td class="name" nowrap><a href="#exec">exec</a>&nbsp;(command)</td>
229 <td class="summary">
230
231 Execute a given shell command and capture its standard output
232 </td>
233 </tr>
234
235 <tr>
236 <td class="name" nowrap><a href="#getenv">getenv</a>&nbsp;(var)</td>
237 <td class="summary">
238
239 Retrieve environment variables.</td>
240 </tr>
241
242 <tr>
243 <td class="name" nowrap><a href="#hostname">hostname</a>&nbsp;(String)</td>
244 <td class="summary">
245
246 Get or set the current hostname.</td>
247 </tr>
248
249 <tr>
250 <td class="name" nowrap><a href="#httpget">httpget</a>&nbsp;(url, stream, target)</td>
251 <td class="summary">
252
253 Returns the contents of a documented referred by an URL.</td>
254 </tr>
255
256 <tr>
257 <td class="name" nowrap><a href="#mounts">mounts</a>&nbsp;()</td>
258 <td class="summary">
259
260 Retrieve information about currently mounted file systems.</td>
261 </tr>
262
263 <tr>
264 <td class="name" nowrap><a href="#reboot">reboot</a>&nbsp;()</td>
265 <td class="summary">
266
267 Initiate a system reboot.</td>
268 </tr>
269
270 <tr>
271 <td class="name" nowrap><a href="#syslog">syslog</a>&nbsp;()</td>
272 <td class="summary">
273
274 Retrieves the output of the "logread" command.</td>
275 </tr>
276
277 <tr>
278 <td class="name" nowrap><a href="#uniqueid">uniqueid</a>&nbsp;(bytes)</td>
279 <td class="summary">
280
281 Generates a random id with specified length.</td>
282 </tr>
283
284 <tr>
285 <td class="name" nowrap><a href="#uptime">uptime</a>&nbsp;()</td>
286 <td class="summary">
287
288 Returns the current system uptime stats.</td>
289 </tr>
290
291 </table>
292
293
294
295
296
297
298 <br/>
299 <br/>
300
301
302 <h2><a name="functions"></a>Functions</h2>
303 <dl class="function">
304
305
306
307 <dt><a name="call"></a><strong>call</strong>&nbsp;(...)</dt>
308 <dd>
309
310
311 Execute a given shell command and return the error code
312
313
314
315 <h3>Parameters</h3>
316 <ul>
317
318 <li>
319 ...: Command to call
320 </li>
321
322 </ul>
323
324
325
326
327
328
329 <h3>Return value:</h3>
330 Error code of the command
331
332
333
334 </dd>
335
336
337
338
339 <dt><a name="dmesg"></a><strong>dmesg</strong>&nbsp;()</dt>
340 <dd>
341
342
343 Retrieves the output of the "dmesg" command.
344
345
346
347
348
349
350
351
352 <h3>Return value:</h3>
353 String containing the current log buffer
354
355
356
357 </dd>
358
359
360
361
362 <dt><a name="exec"></a><strong>exec</strong>&nbsp;(command)</dt>
363 <dd>
364
365
366 Execute a given shell command and capture its standard output
367
368
369
370 <h3>Parameters</h3>
371 <ul>
372
373 <li>
374 command: Command to call
375 </li>
376
377 </ul>
378
379
380
381
382
383
384 <h3>Return value:</h3>
385 String containing the return the output of the command
386
387
388
389 </dd>
390
391
392
393
394 <dt><a name="getenv"></a><strong>getenv</strong>&nbsp;(var)</dt>
395 <dd>
396
397
398 Retrieve environment variables. If no variable is given then a table
399
400 containing the whole environment is returned otherwise this function returns
401 the corresponding string value for the given name or nil if no such variable
402 exists.
403
404
405 <h3>Parameters</h3>
406 <ul>
407
408 <li>
409 var: Name of the environment variable to retrieve (optional)
410 </li>
411
412 </ul>
413
414
415
416
417
418
419 <h3>Return values:</h3>
420 <ol>
421
422 <li>String containing the value of the specified variable
423
424 <li>Table containing all variables if no variable name is given
425
426 </ol>
427
428
429
430 </dd>
431
432
433
434
435 <dt><a name="hostname"></a><strong>hostname</strong>&nbsp;(String)</dt>
436 <dd>
437
438
439 Get or set the current hostname.
440
441
442
443 <h3>Parameters</h3>
444 <ul>
445
446 <li>
447 String: containing a new hostname to set (optional)
448 </li>
449
450 </ul>
451
452
453
454
455
456
457 <h3>Return value:</h3>
458 String containing the system hostname
459
460
461
462 </dd>
463
464
465
466
467 <dt><a name="httpget"></a><strong>httpget</strong>&nbsp;(url, stream, target)</dt>
468 <dd>
469
470
471 Returns the contents of a documented referred by an URL.
472
473
474
475 <h3>Parameters</h3>
476 <ul>
477
478 <li>
479 url: The URL to retrieve
480 </li>
481
482 <li>
483 stream: Return a stream instead of a buffer
484 </li>
485
486 <li>
487 target: Directly write to target file name
488 </li>
489
490 </ul>
491
492
493
494
495
496
497 <h3>Return value:</h3>
498 String containing the contents of given the URL
499
500
501
502 </dd>
503
504
505
506
507 <dt><a name="mounts"></a><strong>mounts</strong>&nbsp;()</dt>
508 <dd>
509
510
511 Retrieve information about currently mounted file systems.
512
513
514
515
516
517
518
519
520 <h3>Return value:</h3>
521 Table containing mount information
522
523
524
525 </dd>
526
527
528
529
530 <dt><a name="reboot"></a><strong>reboot</strong>&nbsp;()</dt>
531 <dd>
532
533
534 Initiate a system reboot.
535
536
537
538
539
540
541
542
543 <h3>Return value:</h3>
544 Return value of os.execute()
545
546
547
548 </dd>
549
550
551
552
553 <dt><a name="syslog"></a><strong>syslog</strong>&nbsp;()</dt>
554 <dd>
555
556
557 Retrieves the output of the "logread" command.
558
559
560
561
562
563
564
565
566 <h3>Return value:</h3>
567 String containing the current log buffer
568
569
570
571 </dd>
572
573
574
575
576 <dt><a name="uniqueid"></a><strong>uniqueid</strong>&nbsp;(bytes)</dt>
577 <dd>
578
579
580 Generates a random id with specified length.
581
582
583
584 <h3>Parameters</h3>
585 <ul>
586
587 <li>
588 bytes: Number of bytes for the unique id
589 </li>
590
591 </ul>
592
593
594
595
596
597
598 <h3>Return value:</h3>
599 String containing hex encoded id
600
601
602
603 </dd>
604
605
606
607
608 <dt><a name="uptime"></a><strong>uptime</strong>&nbsp;()</dt>
609 <dd>
610
611
612 Returns the current system uptime stats.
613
614
615
616
617
618
619
620
621 <h3>Return value:</h3>
622 String containing total uptime in seconds
623
624
625
626 </dd>
627
628
629 </dl>
630
631
632
633
634
635 </div> <!-- id="content" -->
636
637 </div> <!-- id="main" -->
638
639 <div id="about">
640 <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>
641 </div> <!-- id="about" -->
642
643 </div> <!-- id="container" -->
644 </body>
645 </html>