From d1414be04a0dbb474553bfba59fb8d1bb1d2f117 Mon Sep 17 00:00:00 2001 From: andreas Date: Sun, 13 Sep 2009 16:00:21 +0000 Subject: [PATCH] add mlog.cgi script --- mlog.cgi | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 mlog.cgi diff --git a/mlog.cgi b/mlog.cgi new file mode 100755 index 0000000..55dcd5d --- /dev/null +++ b/mlog.cgi @@ -0,0 +1,58 @@ +#!/usr/bin/env python + +import string, os +VER="mlog 1.00" + +hosts=["weekend", "wingbat"] + +URI="/~andreas/private/mlog.cgi?" + +print "Content-type: text/html" +print "max-age: 0" +print "expires: 0" +print "pragma: no-cache" +print "" +print "" +print "" +print "" +print "Motion Log" +print "" +print "

Motion Log

" +print "" +print '' +print "
"
+
+
+def hstlines(host):
+	cmd="/sbin/ping -c 1 -w 2 %s 2>&1 >/dev/null" % host
+	r=os.system(cmd)
+	if r == 0:
+		p=os.popen("rsh %s tail -200 .heyu/logs/motion.log | grep -v again | tail -32" % host, "r")
+		l=p.readlines()
+	else:
+		l=["Host %s is unreachable      " % host]
+	return l
+
+rep=[]
+for host in  hosts:
+	rep.append(hstlines(host))
+
+print ''
+i=0
+print "" % string.join(hosts,'" % string.join(line,'      
%s
') +while 1: + line=[] + f=0 + for h in rep: + try: + line.append(h[i][:-1]) + f=1 + except: + line.append("") + if f == 0: + break + print "
%s
') + i+=1 +print '
' + +execfile("/home/andreas/cgi-bin/trailer.py")