documentation: regenerate documents from current code base
[project/luci.git] / documentation / 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/nixio.html">nixio</a>
129         </li>
130
131         <li>
132                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
133         </li>
134
135         <li>
136                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
137         </li>
138
139         <li>
140                 <a href="../modules/nixio.File.html">nixio.File</a>
141         </li>
142
143         <li>
144                 <a href="../modules/nixio.README.html">nixio.README</a>
145         </li>
146
147         <li>
148                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
149         </li>
150
151         <li>
152                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
153         </li>
154
155         <li>
156                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
157         </li>
158
159         <li>
160                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
161         </li>
162
163         <li>
164                 <a href="../modules/nixio.bin.html">nixio.bin</a>
165         </li>
166
167         <li>
168                 <a href="../modules/nixio.bit.html">nixio.bit</a>
169         </li>
170
171         <li>
172                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
173         </li>
174
175         <li>
176                 <a href="../modules/nixio.fs.html">nixio.fs</a>
177         </li>
178
179 </ul>
180
181
182
183 <!-- File list -->
184
185
186
187
188
189
190
191 </div><!-- id="navigation" -->
192
193 <div id="content">
194
195 <h1>Class <code>luci.sys</code></h1>
196
197 <p></p>
198
199
200
201
202
203
204
205 <h2>Functions</h2>
206 <table class="function_list">
207
208         <tr>
209         <td class="name" nowrap><a href="#call">call</a>&nbsp;(...)</td>
210         <td class="summary">
211  
212 Execute a given shell command and return the error code 
213  </td>
214         </tr>
215
216         <tr>
217         <td class="name" nowrap><a href="#dmesg">dmesg</a>&nbsp;()</td>
218         <td class="summary">
219  
220 Retrieves the output of the "dmesg" command.</td>
221         </tr>
222
223         <tr>
224         <td class="name" nowrap><a href="#exec">exec</a>&nbsp;(command)</td>
225         <td class="summary">
226  
227 Execute a given shell command and capture its standard output 
228  </td>
229         </tr>
230
231         <tr>
232         <td class="name" nowrap><a href="#getenv">getenv</a>&nbsp;(var)</td>
233         <td class="summary">
234  
235 Retrieve environment variables.</td>
236         </tr>
237
238         <tr>
239         <td class="name" nowrap><a href="#hostname">hostname</a>&nbsp;(String)</td>
240         <td class="summary">
241  
242 Get or set the current hostname.</td>
243         </tr>
244
245         <tr>
246         <td class="name" nowrap><a href="#httpget">httpget</a>&nbsp;(url, stream, target)</td>
247         <td class="summary">
248  
249 Returns the contents of a documented referred by an URL.</td>
250         </tr>
251
252         <tr>
253         <td class="name" nowrap><a href="#mounts">mounts</a>&nbsp;()</td>
254         <td class="summary">
255  
256 Retrieve information about currently mounted file systems.</td>
257         </tr>
258
259         <tr>
260         <td class="name" nowrap><a href="#reboot">reboot</a>&nbsp;()</td>
261         <td class="summary">
262  
263 Initiate a system reboot.</td>
264         </tr>
265
266         <tr>
267         <td class="name" nowrap><a href="#syslog">syslog</a>&nbsp;()</td>
268         <td class="summary">
269  
270 Retrieves the output of the "logread" command.</td>
271         </tr>
272
273         <tr>
274         <td class="name" nowrap><a href="#uniqueid">uniqueid</a>&nbsp;(bytes)</td>
275         <td class="summary">
276  
277 Generates a random id with specified length.</td>
278         </tr>
279
280         <tr>
281         <td class="name" nowrap><a href="#uptime">uptime</a>&nbsp;()</td>
282         <td class="summary">
283  
284 Returns the current system uptime stats.</td>
285         </tr>
286
287 </table>
288
289
290
291
292
293
294 <br/>
295 <br/>
296
297
298 <h2><a name="functions"></a>Functions</h2>
299 <dl class="function">
300
301
302
303 <dt><a name="call"></a><strong>call</strong>&nbsp;(...)</dt>
304 <dd>
305
306  
307 Execute a given shell command and return the error code 
308
309
310
311 <h3>Parameters</h3>
312 <ul>
313         
314         <li>
315           ...: Command to call
316         </li>
317         
318 </ul>
319
320
321
322
323
324
325 <h3>Return value:</h3>
326 Error code of the command
327
328
329
330 </dd>
331
332
333
334
335 <dt><a name="dmesg"></a><strong>dmesg</strong>&nbsp;()</dt>
336 <dd>
337
338  
339 Retrieves the output of the "dmesg" command. 
340
341
342
343
344
345
346
347
348 <h3>Return value:</h3>
349 String containing the current log buffer
350
351
352
353 </dd>
354
355
356
357
358 <dt><a name="exec"></a><strong>exec</strong>&nbsp;(command)</dt>
359 <dd>
360
361  
362 Execute a given shell command and capture its standard output 
363
364
365
366 <h3>Parameters</h3>
367 <ul>
368         
369         <li>
370           command: Command to call
371         </li>
372         
373 </ul>
374
375
376
377
378
379
380 <h3>Return value:</h3>
381 String containg the return the output of the command
382
383
384
385 </dd>
386
387
388
389
390 <dt><a name="getenv"></a><strong>getenv</strong>&nbsp;(var)</dt>
391 <dd>
392
393  
394 Retrieve environment variables. If no variable is given then a table 
395  
396 containing the whole environment is returned otherwise this function returns 
397 the corresponding string value for the given name or nil if no such variable 
398 exists.
399
400
401 <h3>Parameters</h3>
402 <ul>
403         
404         <li>
405           var: Name of the environment variable to retrieve (optional)
406         </li>
407         
408 </ul>
409
410
411
412
413
414
415 <h3>Return values:</h3>
416 <ol>
417         
418         <li>String containg the value of the specified variable
419         
420         <li>Table containing all variables if no variable name is given
421         
422 </ol>
423
424
425
426 </dd>
427
428
429
430
431 <dt><a name="hostname"></a><strong>hostname</strong>&nbsp;(String)</dt>
432 <dd>
433
434  
435 Get or set the current hostname. 
436
437
438
439 <h3>Parameters</h3>
440 <ul>
441         
442         <li>
443           String: containing a new hostname to set (optional)
444         </li>
445         
446 </ul>
447
448
449
450
451
452
453 <h3>Return value:</h3>
454 String containing the system hostname
455
456
457
458 </dd>
459
460
461
462
463 <dt><a name="httpget"></a><strong>httpget</strong>&nbsp;(url, stream, target)</dt>
464 <dd>
465
466  
467 Returns the contents of a documented referred by an URL. 
468
469
470
471 <h3>Parameters</h3>
472 <ul>
473         
474         <li>
475           url: The URL to retrieve
476         </li>
477         
478         <li>
479           stream: Return a stream instead of a buffer
480         </li>
481         
482         <li>
483           target: Directly write to target file name
484         </li>
485         
486 </ul>
487
488
489
490
491
492
493 <h3>Return value:</h3>
494 String containing the contents of given the URL
495
496
497
498 </dd>
499
500
501
502
503 <dt><a name="mounts"></a><strong>mounts</strong>&nbsp;()</dt>
504 <dd>
505
506  
507 Retrieve information about currently mounted file systems. 
508
509
510
511
512
513
514
515
516 <h3>Return value:</h3>
517 Table containing mount information
518
519
520
521 </dd>
522
523
524
525
526 <dt><a name="reboot"></a><strong>reboot</strong>&nbsp;()</dt>
527 <dd>
528
529  
530 Initiate a system reboot. 
531
532
533
534
535
536
537
538
539 <h3>Return value:</h3>
540 Return value of os.execute()
541
542
543
544 </dd>
545
546
547
548
549 <dt><a name="syslog"></a><strong>syslog</strong>&nbsp;()</dt>
550 <dd>
551
552  
553 Retrieves the output of the "logread" command. 
554
555
556
557
558
559
560
561
562 <h3>Return value:</h3>
563 String containing the current log buffer
564
565
566
567 </dd>
568
569
570
571
572 <dt><a name="uniqueid"></a><strong>uniqueid</strong>&nbsp;(bytes)</dt>
573 <dd>
574
575  
576 Generates a random id with specified length. 
577
578
579
580 <h3>Parameters</h3>
581 <ul>
582         
583         <li>
584           bytes: Number of bytes for the unique id
585         </li>
586         
587 </ul>
588
589
590
591
592
593
594 <h3>Return value:</h3>
595 String containing hex encoded id
596
597
598
599 </dd>
600
601
602
603
604 <dt><a name="uptime"></a><strong>uptime</strong>&nbsp;()</dt>
605 <dd>
606
607  
608 Returns the current system uptime stats. 
609
610
611
612
613
614
615
616
617 <h3>Return value:</h3>
618 String containing total uptime in seconds
619
620
621
622 </dd>
623
624
625 </dl>
626
627
628
629
630
631 </div> <!-- id="content" -->
632
633 </div> <!-- id="main" -->
634
635 <div id="about">
636         <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>
637 </div> <!-- id="about" -->
638
639 </div> <!-- id="container" -->
640 </body>
641 </html>