diff --git a/script.py b/script.py index 4d2f248..5f518c0 100644 --- a/script.py +++ b/script.py @@ -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) diff --git a/templates/template.jinja b/templates/template.jinja index 0106eb4..cc7a057 100644 --- a/templates/template.jinja +++ b/templates/template.jinja @@ -7,5 +7,8 @@
Or say something about who was here?
+{{ last_here }}+