processes.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 
00003 """
00004 usage: %(progname)s [args]
00005 """
00006 
00007 import config
00008 
00009 import string
00010 import subprocess
00011 from pyclearsilver.log import *
00012 
00013 import MBPage
00014 import webutil
00015 
00016 
00017 class MyPage(MBPage.MBPage):
00018   def setup(self, hdf):
00019     pass
00020     
00021   def display(self, hdf):
00022     webutil.grabTopics(hdf, [])
00023     webutil.set_tabs(hdf, ["status", "processes"])    
00024     try:
00025       proc = subprocess.Popen(["sudo", "ckill", "list"], stdout=subprocess.PIPE)
00026       out, err = proc.communicate()
00027       out = string.strip(out)
00028       i = 0
00029       lines = out.split('\n')
00030       if out == "" and hdf.getValue("Query.reset", "") != "":
00031         self.redirectUri(config.gBaseURL + "webui/reset.py?Action.DoReset=1")
00032       else:
00033         for line in lines:
00034           hdf.setValue("CGI.cur.lines.%d" % i, line)
00035           i += 1
00036 
00037     except:
00038       hdf.setValue("CGI.cur.error", "Unable to call ckill on this robot.")
00039           
00040 def run(context):
00041   return MyPage(context, pagename="processes", nologin=False)
00042 
00043 def main():
00044   context = CSPage.Context()
00045   run(context).start()
00046 
00047 if __name__ == "__main__":
00048   main()


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:00