mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-12-26 06:28:07 +00:00
Add log to upgrade page
This commit is contained in:
parent
fc3ee4f62d
commit
6ea18606c9
|
@ -59,15 +59,16 @@ sleep 1
|
||||||
sync
|
sync
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# Run post upgrade script
|
|
||||||
VERSION=$(cat /usr/share/mynode/version)
|
VERSION=$(cat /usr/share/mynode/version)
|
||||||
|
|
||||||
|
# Clear old upgrade logs
|
||||||
|
rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_*
|
||||||
|
rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_*
|
||||||
|
|
||||||
|
# Run post upgrade script
|
||||||
touch $UPGRADE_ERROR_FILE
|
touch $UPGRADE_ERROR_FILE
|
||||||
for i in {1..5}
|
for i in {1..5}
|
||||||
do
|
do
|
||||||
# Clear old upgrade logs
|
|
||||||
rm -f /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_*
|
|
||||||
rm -f /home/admin/upgrade_logs/upgrade_log_latest_post_*
|
|
||||||
|
|
||||||
/bin/bash /usr/bin/mynode_post_upgrade.sh 2>&1 | tee /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt /home/admin/upgrade_logs/upgrade_log_latest_post_${i}.txt
|
/bin/bash /usr/bin/mynode_post_upgrade.sh 2>&1 | tee /home/admin/upgrade_logs/upgrade_log_${VERSION}_post_${i}.txt /home/admin/upgrade_logs/upgrade_log_latest_post_${i}.txt
|
||||||
RC=$?
|
RC=$?
|
||||||
if [ "${RC}" -eq "0" ]; then
|
if [ "${RC}" -eq "0" ]; then
|
||||||
|
|
|
@ -298,6 +298,7 @@ def upgrade_page():
|
||||||
"title": "myNode Upgrade",
|
"title": "myNode Upgrade",
|
||||||
"header_text": "Upgrading",
|
"header_text": "Upgrading",
|
||||||
"subheader_text": "This may take a while...",
|
"subheader_text": "This may take a while...",
|
||||||
|
"show_upgrade_log": True,
|
||||||
"ui_settings": read_ui_settings()
|
"ui_settings": read_ui_settings()
|
||||||
}
|
}
|
||||||
return render_template('reboot.html', **templateData)
|
return render_template('reboot.html', **templateData)
|
||||||
|
@ -317,11 +318,12 @@ def upgrade_beta_page():
|
||||||
"title": "myNode Upgrade",
|
"title": "myNode Upgrade",
|
||||||
"header_text": "Upgrading",
|
"header_text": "Upgrading",
|
||||||
"subheader_text": "This may take a while...",
|
"subheader_text": "This may take a while...",
|
||||||
|
"show_upgrade_log": True,
|
||||||
"ui_settings": read_ui_settings()
|
"ui_settings": read_ui_settings()
|
||||||
}
|
}
|
||||||
return render_template('reboot.html', **templateData)
|
return render_template('reboot.html', **templateData)
|
||||||
|
|
||||||
@mynode_settings.route("/settings/get-upgrade-log")
|
@mynode_settings.route("/settings/get-upgrade-log-raw")
|
||||||
def get_upgrade_log_page():
|
def get_upgrade_log_page():
|
||||||
check_logged_in()
|
check_logged_in()
|
||||||
|
|
||||||
|
@ -331,6 +333,20 @@ def get_upgrade_log_page():
|
||||||
|
|
||||||
return log
|
return log
|
||||||
|
|
||||||
|
@mynode_settings.route("/settings/upgrade-test")
|
||||||
|
def upgrade_page_test():
|
||||||
|
check_logged_in()
|
||||||
|
|
||||||
|
# Display wait page
|
||||||
|
templateData = {
|
||||||
|
"title": "myNode Upgrade",
|
||||||
|
"header_text": "Upgrading",
|
||||||
|
"subheader_text": "This may take a while...",
|
||||||
|
"show_upgrade_log": True,
|
||||||
|
"ui_settings": read_ui_settings()
|
||||||
|
}
|
||||||
|
return render_template('reboot.html', **templateData)
|
||||||
|
|
||||||
@mynode_settings.route("/settings/get-latest-version")
|
@mynode_settings.route("/settings/get-latest-version")
|
||||||
def get_latest_version_page():
|
def get_latest_version_page():
|
||||||
check_logged_in()
|
check_logged_in()
|
||||||
|
|
|
@ -31,6 +31,29 @@
|
||||||
|
|
||||||
checkStatus()
|
checkStatus()
|
||||||
setInterval(checkStatus, 2500);
|
setInterval(checkStatus, 2500);
|
||||||
|
|
||||||
|
{% if show_upgrade_log is defined and show_upgrade_log %}
|
||||||
|
function update_upgrade_log () {
|
||||||
|
console.log("Updating upgrade log...");
|
||||||
|
$.get("/settings/get-upgrade-log-raw", function(data) {
|
||||||
|
//console.log(data)
|
||||||
|
data = data.split("\n");
|
||||||
|
data.reverse();
|
||||||
|
log = data.join("\n")
|
||||||
|
console.log("Displaying " + data.length + " lines")
|
||||||
|
$("#upgrade_log_contents").html(log)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$("#show_upgrade_log").on("click", function() {
|
||||||
|
$("#show_upgrade_log").hide(0);
|
||||||
|
$("#loading_spinner").hide(0);
|
||||||
|
|
||||||
|
update_upgrade_log()
|
||||||
|
setInterval(update_upgrade_log, 4000);
|
||||||
|
|
||||||
|
$("#upgrade_log").show();
|
||||||
|
});
|
||||||
|
{% endif %}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -46,8 +69,16 @@
|
||||||
<br/>
|
<br/>
|
||||||
<p class="shutoff_warning">please do not power off or unplug device</p>
|
<p class="shutoff_warning">please do not power off or unplug device</p>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<img class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
|
|
||||||
|
{% if show_upgrade_log is defined and show_upgrade_log %}
|
||||||
|
<button id="show_upgrade_log" class="ui-button ui-widget ui-corner-all settings_button_small">Show Upgrade Log</button>
|
||||||
|
<div class="cli_contents" id="upgrade_log" style="display: none; height: 300px; max-height: 300px;">
|
||||||
|
<pre id="upgrade_log_contents" style="text-align: left; font-size: 10px;"></pre>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user