Add reboot/upgrade message if home page is loaded during reboot/upgrade

This commit is contained in:
Taylor Helsper 2021-01-07 12:49:29 -06:00
parent 98458efa18
commit 79e03dd893
3 changed files with 26 additions and 0 deletions

View File

@ -9,6 +9,9 @@ set -e
# Make sure time is in the log # Make sure time is in the log
date date
# Mark we are upgrading
echo "upgrading" > $MYNODE_STATUS_FILE
# Shut down main services to save memory and CPU # Shut down main services to save memory and CPU
/usr/bin/mynode_stop_critical_services.sh /usr/bin/mynode_stop_critical_services.sh

View File

@ -55,6 +55,9 @@ def shutdown_device():
os.system("/usr/bin/mynode_stop_critical_services.sh") os.system("/usr/bin/mynode_stop_critical_services.sh")
os.system("shutdown -h now") os.system("shutdown -h now")
def is_shutting_down():
return os.path.isfile("/tmp/shutting_down")
def factory_reset(): def factory_reset():
# Reset subsystems that have local data # Reset subsystems that have local data
delete_quicksync_data() delete_quicksync_data()
@ -386,6 +389,8 @@ STATE_QUICKSYNC_RESET = "quicksync_reset"
STATE_STABLE = "stable" STATE_STABLE = "stable"
STATE_ROOTFS_READ_ONLY = "rootfs_read_only" STATE_ROOTFS_READ_ONLY = "rootfs_read_only"
STATE_HDD_READ_ONLY = "hdd_read_only" STATE_HDD_READ_ONLY = "hdd_read_only"
STATE_SHUTTING_DOWN = "shutting_down"
STATE_UPGRADING = "upgrading"
STATE_UNKNOWN = "unknown" STATE_UNKNOWN = "unknown"
def get_mynode_status(): def get_mynode_status():

View File

@ -279,6 +279,24 @@ def index():
"ui_settings": read_ui_settings() "ui_settings": read_ui_settings()
} }
return render_template('state.html', **templateData) return render_template('state.html', **templateData)
elif status == STATE_UPGRADING:
templateData = {
"title": "myNode Upgrading",
"header_text": "Upgrading...",
"subheader_text": "This may take a while...",
"refresh_rate": 120,
"ui_settings": read_ui_settings()
}
return render_template('state.html', **templateData)
elif status == STATE_SHUTTING_DOWN or is_shutting_down():
templateData = {
"title": "myNode Reboot",
"header_text": "Restarting",
"subheader_text": "This will take several minutes...",
"refresh_rate": 120,
"ui_settings": read_ui_settings()
}
return render_template('state.html', **templateData)
elif status == STATE_STABLE: elif status == STATE_STABLE:
bitcoind_status_code = get_service_status_code("bitcoind") bitcoind_status_code = get_service_status_code("bitcoind")
lnd_status_code = get_service_status_code("lnd") lnd_status_code = get_service_status_code("lnd")