|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
|
|
|
|
|
q
|
|
|
|
|
from jinja2 import Environment, FileSystemLoader
|
|
|
|
|
|
|
|
|
|
## Getting the data
|
|
|
|
@ -6,9 +6,9 @@ import subprocess
|
|
|
|
|
|
|
|
|
|
#subprocess.run(["ls", "-l"])
|
|
|
|
|
#print(os.popen("ls -l").read())
|
|
|
|
|
thing = subprocess.run(["uptime", "-p"], capture_output=True)
|
|
|
|
|
print(thing.stdout)
|
|
|
|
|
|
|
|
|
|
uptime = subprocess.run(["uptime", "-p"], capture_output=True)
|
|
|
|
|
#print(thing.stdout)
|
|
|
|
|
last_here = subprocess.run(["last", "-s", "today"], capture_output=True)
|
|
|
|
|
## Creating the HTML
|
|
|
|
|
|
|
|
|
|
# loading the environment
|
|
|
|
@ -18,7 +18,7 @@ env = Environment(loader = FileSystemLoader('templates'))
|
|
|
|
|
template = env.get_template('template.jinja')
|
|
|
|
|
|
|
|
|
|
# rendering the template and storing the resultant text in variable output
|
|
|
|
|
output = template.render(uptime = thing.stdout)
|
|
|
|
|
output = template.render(uptime = uptime.stdout, last_here=last_here.stdout)
|
|
|
|
|
|
|
|
|
|
# printing the output on screen
|
|
|
|
|
print(output)
|
|
|
|
|