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