通过lua脚本获取wan联网状态:
#!/usr/bin/lua
require 'luci.sys'
print("Content-Type: text/html")
print("")
status = luci.sys.exec("ifstatus wan")
print(status)
通过sh:
#!/bin/sh
echo "Content-Type: text/html"
echo ""
echo `ifstatus wan`
保存到/www/cgi-bin/目录,并添加执行权限,测试:
curl 192.168.1.1/cgi-bin/file
标签:openwrt, pandorabox, cgi-bin