mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 08:29:16 +00:00
Run fsck on each boot and save results
This commit is contained in:
parent
9ffee5af01
commit
b6635fd3f7
|
@ -41,14 +41,17 @@ if [ $IS_RASPI -eq 1 ] || [ $IS_ROCKPRO64 -eq 1 ]; then
|
|||
fi
|
||||
umount /mnt/hdd || true
|
||||
|
||||
# Check for drive-repair
|
||||
if [ -f /home/bitcoin/.mynode/check_drive ]; then
|
||||
# Check drive
|
||||
set +e
|
||||
for d in /dev/sd*1; do
|
||||
echo "Repairing drive $d ...";
|
||||
fsck -y $d
|
||||
done
|
||||
rm /home/bitcoin/.mynode/check_drive
|
||||
RC=$(fsck -y $d > /tmp/fsck_results 2>&1)
|
||||
if [ $RC -ne 0 ]; then
|
||||
touch /tmp/fsck_error
|
||||
fi
|
||||
done
|
||||
set -e
|
||||
|
||||
|
||||
# Mount HDD (format if necessary)
|
||||
while [ ! -f /mnt/hdd/.mynode ]
|
||||
|
|
|
@ -120,6 +120,15 @@ def delete_product_key_error():
|
|||
os.system("rm -rf /home/bitcoin/.mynode/.product_key_error")
|
||||
os.system("rm -rf /mnt/hdd/mynode/settings/.product_key_error")
|
||||
|
||||
def has_fsck_error():
|
||||
return os.path.isfile("/tmp/fsck_error")
|
||||
def get_fsck_results():
|
||||
try:
|
||||
with open("/tmp/fsck_results", "r") as f:
|
||||
return f.read()
|
||||
except:
|
||||
return "ERROR"
|
||||
return "ERROR"
|
||||
|
||||
def get_local_ip():
|
||||
local_ip = "unknown"
|
||||
|
|
|
@ -369,6 +369,8 @@ def index():
|
|||
"vpn_enabled": is_vpn_enabled(),
|
||||
"product_key_skipped": pk_skipped,
|
||||
"product_key_error": pk_error,
|
||||
"fsck_error": has_fsck_error(),
|
||||
"fsck_results": get_fsck_results(),
|
||||
"drive_usage": get_drive_usage(),
|
||||
"cpu_usage": get_cpu_usage(),
|
||||
"ram_usage": get_ram_usage(),
|
||||
|
|
|
@ -385,27 +385,6 @@ def download_logs_page():
|
|||
|
||||
return send_from_directory(directory="/tmp/", filename="mynode_logs.tar.gz")
|
||||
|
||||
@mynode_settings.route("/settings/repair-drive")
|
||||
def repair_drive_page():
|
||||
check_logged_in()
|
||||
|
||||
# Touch files to trigger re-checking drive
|
||||
os.system("touch /home/bitcoin/.mynode/check_drive")
|
||||
os.system("sync")
|
||||
|
||||
# Trigger reboot
|
||||
t = Timer(1.0, reboot_device)
|
||||
t.start()
|
||||
|
||||
# Wait until device is restarted
|
||||
templateData = {
|
||||
"title": "myNode Reboot",
|
||||
"header_text": "Restarting",
|
||||
"subheader_text": "This will take several minutes...",
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
return render_template('reboot.html', **templateData)
|
||||
|
||||
@mynode_settings.route("/settings/regen-https-certs")
|
||||
def regen_https_certs_page():
|
||||
check_logged_in()
|
||||
|
|
|
@ -133,6 +133,15 @@
|
|||
|
||||
{% include 'includes/message_display.html' %}
|
||||
|
||||
{% if fsck_error %}
|
||||
<div class="main_page_error_block">
|
||||
<center>
|
||||
<p>There may be an error with the filesystem on your drive.</p>
|
||||
<p>{{ fsck_results }}</p>
|
||||
</center>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not has_changed_password %}
|
||||
<div class="upgrade_ad_main_page">
|
||||
<p style="text-align: center;"><b>Warning!</b><br/>You appear to be using the default password! You should change it to something else on the <a href="/settings">settings</a> page.</p>
|
||||
|
|
|
@ -617,13 +617,6 @@
|
|||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Repair Drive</div>
|
||||
This will attempt to repair and block errors on your external drive. Please make a backup before running. This will reboot the device.
|
||||
<br/>
|
||||
<a href="/settings/repair-drive" class="ui-button ui-widget ui-corner-all settings_button">Repair Drive</a>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Factory Reset</div>
|
||||
This will factory reset your mynode and all storage will be completely reset. Make sure you have backed up all your keys and wallets!
|
||||
<br/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user