Last change
on this file since 10123 was 10123, checked in by richardvm, 13 years ago |
creating trunk based on 9.0
|
-
Property svn:executable
set to
*
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/usr/local/bin/python
|
---|
2 | #
|
---|
3 | # Wireless Leiden webinterface for (embedded) nodes
|
---|
4 | # Rick van der Zwet <info@rickvanderzwet.nl>
|
---|
5 | # Richard van Mansom (richardvm@wirelessleiden.nl), striped the webserver
|
---|
6 |
|
---|
7 | from subprocess import *
|
---|
8 | import os
|
---|
9 |
|
---|
10 | def tailFile(file):
|
---|
11 | lines=-10
|
---|
12 | return("<em>Tail (%i): %s</em><br /><pre>%s</pre>" % (lines,file,Popen(["tail", str(lines), file], stdout=PIPE).communicate()[0]));
|
---|
13 |
|
---|
14 | def catFile(file):
|
---|
15 | return("<em>File: %s</em><br /><pre>%s</pre>" % (file,Popen(["cat", file], stdout=PIPE).communicate()[0]));
|
---|
16 |
|
---|
17 | def allRoutes():
|
---|
18 | return("<em>netstat -nr</em><br /><pre>%s</pre>" % Popen(["netstat", "-n", "-r"], stdout=PIPE).communicate()[0]);
|
---|
19 |
|
---|
20 | def processList():
|
---|
21 | return("<em>ps -aux</em><br /><pre>%s</pre>" % Popen(["ps", "-a", "-u", "-x"], stdout=PIPE).communicate()[0]);
|
---|
22 |
|
---|
23 |
|
---|
24 | def main():
|
---|
25 | return ( "Content-Type: text/html\n\n" +
|
---|
26 | "<img src='/static/wl-logo.png' />" +
|
---|
27 | "Welcome to <a href='http://www.wirelessleiden.nl'>Stichting Wireless Leiden</a> host/node <em>" +
|
---|
28 | Popen(["hostname"], stdout=PIPE).communicate()[0] +
|
---|
29 | "</em><p />" + tailFile('/var/log/messages') + "<p />" +
|
---|
30 | tailFile('/var/log/debug.log') + "<p />" +
|
---|
31 | catFile('/var/run/dmesg.boot') + "<p />" +
|
---|
32 | allRoutes() + "<p />" +
|
---|
33 | processList() + "<p />" +
|
---|
34 | "<em>$Id$</em>" )
|
---|
35 |
|
---|
36 | print main()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.