update the script

main
vitrinekast 10 months ago
parent d0758a984c
commit b8e3c940d0

@ -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)

@ -7,5 +7,8 @@
</head>
<body>
<h1>I am a HTML page fillllllled with data, such as the {{ uptime }}</h1>
<p>Or say something about who was here?</p>
<pre>{{ last_here }}</pre>
</body>
</html>

Loading…
Cancel
Save