Add button to restart electrum server

This commit is contained in:
Taylor Helsper 2021-03-02 22:11:03 -06:00
parent d7e5ebb5ce
commit 86cd1cc3e2
3 changed files with 25 additions and 2 deletions

View File

@ -999,6 +999,13 @@ def delete_lnd_data():
def stop_electrs():
os.system("systemctl stop electrs")
def restart_electrs_actual():
os.system("systemctl restart electrs")
def restart_electrs():
t = Timer(0.1, restart_electrs_actual)
t.start()
def delete_electrs_data():
os.system("rm -rf /mnt/hdd/mynode/electrs")

View File

@ -1,8 +1,8 @@
from flask import Blueprint, render_template, session, abort, Markup, request, redirect
from flask import Blueprint, render_template, session, abort, Markup, request, redirect, flash
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from pprint import pprint, pformat
from bitcoin_info import *
from device_info import get_local_ip, skipped_product_key, get_onion_url_electrs, read_ui_settings
from device_info import get_local_ip, skipped_product_key, get_onion_url_electrs, read_ui_settings, restart_electrs
from user_management import check_logged_in
from electrum_info import *
import json
@ -55,3 +55,10 @@ def electrum_server_page():
"ui_settings": read_ui_settings()
}
return render_template('electrum_server.html', **templateData)
@mynode_electrum_server.route("/restart-electrs")
def page_restart_electrs():
check_logged_in()
restart_electrs()
flash("Restarting electrum server...", category="message")
return redirect("/electrum-server")

View File

@ -11,6 +11,9 @@
</div>
<div class="main_header">Electrum Server Status</div>
{% include 'includes/message_display.html' %}
<br/>
<div class="app_tile_row">
@ -22,6 +25,12 @@
<div class="info_tile_header">Current Block</div>
<div class="info_tile_contents">{{current_block}}</div>
</div>
<div class="info_tile">
<div class="info_tile_header">Restart</div>
<div class="info_tile_contents">
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 70%;" href="/restart-electrs">Restart</a>
</div>
</div>
</div>
<div class="app_tile_row">