mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 00:19:15 +00:00
Add uptime to settings page
This commit is contained in:
parent
262c75b69c
commit
2b7d6364e9
|
@ -28,6 +28,12 @@ def get_latest_version():
|
||||||
return latest_version
|
return latest_version
|
||||||
|
|
||||||
|
|
||||||
|
def get_system_uptime():
|
||||||
|
uptime = subprocess.check_output('awk \'{print int($1/86400)" days "int($1%86400/3600)" hour(s) "int(($1%3600)/60)" minute(s) "int($1%60)" seconds(s)"}\' /proc/uptime', shell=True)
|
||||||
|
uptime = uptime.strip()
|
||||||
|
return uptime
|
||||||
|
|
||||||
|
|
||||||
def get_device_serial():
|
def get_device_serial():
|
||||||
serial = subprocess.check_output("cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2", shell=True)
|
serial = subprocess.check_output("cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2", shell=True)
|
||||||
serial = serial.strip()
|
serial = serial.strip()
|
||||||
|
|
|
@ -101,6 +101,7 @@ def page_settings():
|
||||||
product_key = get_product_key()
|
product_key = get_product_key()
|
||||||
pk_skipped = skipped_product_key()
|
pk_skipped = skipped_product_key()
|
||||||
pk_error = not is_valid_product_key()
|
pk_error = not is_valid_product_key()
|
||||||
|
uptime = get_system_uptime()
|
||||||
|
|
||||||
templateData = {
|
templateData = {
|
||||||
"title": "myNode Settings",
|
"title": "myNode Settings",
|
||||||
|
@ -110,7 +111,8 @@ def page_settings():
|
||||||
"serial_number": serial_number,
|
"serial_number": serial_number,
|
||||||
"product_key": product_key,
|
"product_key": product_key,
|
||||||
"product_key_skipped": pk_skipped,
|
"product_key_skipped": pk_skipped,
|
||||||
"product_key_error": pk_error
|
"product_key_error": pk_error,
|
||||||
|
"uptime": uptime
|
||||||
}
|
}
|
||||||
return render_template('settings.html', **templateData)
|
return render_template('settings.html', **templateData)
|
||||||
|
|
||||||
|
|
|
@ -198,6 +198,10 @@
|
||||||
<td>Product Key</td>
|
<td>Product Key</td>
|
||||||
<td style="padding-left: 20px;">{{product_key}}</td>
|
<td style="padding-left: 20px;">{{product_key}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Uptime</td>
|
||||||
|
<td style="padding-left: 20px;">{{uptime}}</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user