--- /dev/null
+#!/bin/sh
+# catprocversion.cgi
+# Ian Roberts
+# May 7 2012
+# CGI to cat /proc/(argument)
+
+cat <<EOF
+Content-type: text/html
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head></head>
+<body>
+EOF
+
+what=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+cat /proc/$what
+
+cat <<EOF
+</body>
+</html>
+EOF
/*
- about.js
+ system.js
Ian Roberts
May 7 2012
var update_time = 10;
+var version = "Linux ....";
// Called when we load page
function initialise() {
mainMenu();
+ loadSystemInfo(); // Kick off cgi scripts
initialisePage();
}
html += '<tr><td colspan="3" align="left" valign="top"><h2>System</h2></td></tr>';
html += '<tr><td colspan="2">Display results of the following shell commands</td></tr>';
- html += '<tr><td colspan="2">cat /proc/version</td></tr>';
- html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+
+ html += '<tr><td colspan="2">cat /proc/version</td></tr>' ;
+ html += '<tr><td div id="version"></div></td></tr>';
+
html += '<tr><td colspan="2">cat /proc/loadavg</td></tr>';
- html += '<tr><td colspan="2">uptime</td></tr>';
+ html += '<tr><td div id="loadavg"></div></td></tr>';
+
html += '<tr><td colspan="2">cat /proc/cpuinfo</td></tr>';
+
html += '<tr><td colspan="2">cat /proc/mtd</td></tr>';
+
html += '<tr><td colspan="2">cat /proc/yaffs</td></tr>';
+
+ html += '<tr><td colspan="2">uptime</td></tr>';
+
+ html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+
html += '<tr><td> </td></tr>';
html += '</table>';
}
+function loadSystemInfo() {
+
+ downloadUrl("/cgi-bin/catproc.cgi?arg=version", loadVersion);
+
+}
+
+function loadVersion(doc, status) {
+
+ document.getElementById('version').innerHTML = doc.substr(doc.indexOf("Linux"), doc.length);
+
+ downloadUrl("/cgi-bin/catproc.cgi?arg=loadavg", loadLoadavg);
+}
+
+function loadLoadavg(doc, status) {
+
+ document.getElementById('loadavg').innerHTML = doc.substr(0, doc.length);
+
+ //downloadUrl("/cgi-bin/catproc.cgi?arg=XXX, loadXXX);
+}