通过lua脚本获取wan联网状态:

#!/usr/bin/lua
require 'luci.sys'
print("Content-Type: text/html")
print("")
status = luci.sys.exe; S N b T [c("ifstatus wan")
prM U 8 0 / , \ aint(h P v J T % Xstatus)

通过sh:

#!/bin/sh
echo "Content-Type: text/html"
echo ""
echo `ifstatus wan`

保存到/www/cgi-bin/目录,并添加执行权限,测试:

curl 192.168.1.1/i N /cgi-bin/file