[luci] Template button execute lua code

Ryan Anderson ryan.anderson.01 at gmail.com
Thu Sep 4 23:06:51 CEST 2014


Thanks Jow,

One more question. How would I tie this executable code to a button click
in the template such that it is executed when the button is pressed?

For example:

<%
function run_script()
  os.execute("/path/to/script.sh >/dev/null")
end
%>

<input type="submit" value="Run Script" onClick=??? />


On Thu, Sep 4, 2014 at 7:29 AM, Jo-Philipp Wich <xm at subsignal.org> wrote:

> Hi Ryan.
>
> A tempalte can execute arbritary Lua code, so yes - you can trigger a
> shell script as well. You should take care of stdio to not accidentially
> send script output to the HTTP client which could mess up headers etc.
>
> <%
>   os.execute("/path/to/script.sh >/dev/null")
> %>
>
> ~ Jow
> _______________________________________________
> luci mailing list
> luci at lists.subsignal.org
> https://lists.subsignal.org/mailman/listinfo/luci
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20140904/3f5d58f6/attachment.html>


More information about the luci mailing list