How to Use System Commands in LUA

Posted on by By Nikhilesh, in Front End | 0

How to use system commands in LUA

Lets assume we have some requirement to call Unix-commands on the click of a button by using LUA .

To achieve this follow these steps :
1. First check your Lua page is working or not ?
 > Run your lua page to ensure that there is no any error in this page.

2. Now we need to configure template file in Lua page.(or you can do it by lua codes also but it has limited CSS )
> For this we need first to create/implement template page in lua file.

Ex : lets assume you have one lua file name (details.lua) .
So first you need to create map in your lua page.
(for detail please refer this blog :

Now you configure your template(getData.htm) in lua file.

<input type=”button” value=”Set” style=”width:71px;” onclick=”<%-=pcdata(self:getData(section))-%>” />

Now in your lua page (details.lua) , you need to write this function.

test1 = readData:option(Value, “_custom”,translate(“Get Data “),”help text “)
readData.nocreate = true
readData.widget = “checkbox”
readData.template = “cbi/getData”
function readData.getData(self,section)
ptr1 =”/usr/bin/runScript  start”

By this way we can run any system-command as value of ptr1

like “ls -ltrh /usr/bin >>/tmp/fileDetails.txt” ….etc

and run on the OS indirectly via LUA page.

Pushpraj Kumar.


Best Open Source Business Intelligence Software Helical Insight is Here


A Business Intelligence Framework

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments