processes.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 
3 """
4 usage: %(progname)s [args]
5 """
6 
7 import config
8 
9 import string
10 import subprocess
11 from pyclearsilver.log import *
12 
13 import MBPage
14 import webutil
15 
16 
18  def setup(self, hdf):
19  pass
20 
21  def display(self, hdf):
22  webutil.grabTopics(hdf, [])
23  webutil.set_tabs(hdf, ["status", "processes"])
24  try:
25  proc = subprocess.Popen(["sudo", "ckill", "list"], stdout=subprocess.PIPE)
26  out, err = proc.communicate()
27  out = string.strip(out)
28  i = 0
29  lines = out.split('\n')
30  if out == "" and hdf.getValue("Query.reset", "") != "":
31  self.redirectUri(config.gBaseURL + "webui/reset.py?Action.DoReset=1")
32  else:
33  for line in lines:
34  hdf.setValue("CGI.cur.lines.%d" % i, line)
35  i += 1
36 
37  except:
38  hdf.setValue("CGI.cur.error", "Unable to call ckill on this robot.")
39 
40 def run(context):
41  return MyPage(context, pagename="processes", nologin=False)
42 
43 def main():
44  context = CSPage.Context()
45  run(context).start()
46 
47 if __name__ == "__main__":
48  main()


webui
Author(s): Scott Hassan
autogenerated on Mon Jun 10 2019 15:51:24