From 86ee9c5dc4f54c5c0a98e0ab6308f9d5001bde62 Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Wed, 18 Dec 2019 21:45:44 -0600 Subject: [PATCH] Add script to store core services --- rootfs/standard/usr/bin/mynode-local-upgrade | 1 + rootfs/standard/usr/bin/mynode_post_upgrade.sh | 5 +---- .../usr/bin/mynode_stop_critical_services.sh | 17 +++++++++++++++++ rootfs/standard/var/www/mynode/device_info.py | 6 ++---- 4 files changed, 21 insertions(+), 8 deletions(-) create mode 100755 rootfs/standard/usr/bin/mynode_stop_critical_services.sh diff --git a/rootfs/standard/usr/bin/mynode-local-upgrade b/rootfs/standard/usr/bin/mynode-local-upgrade index 827a0c45..b1f50a0c 100755 --- a/rootfs/standard/usr/bin/mynode-local-upgrade +++ b/rootfs/standard/usr/bin/mynode-local-upgrade @@ -53,6 +53,7 @@ if [ "$#" -ge 2 ]; then else # Service not found, reboot echo "Unknown service, rebooting" + /usr/bin/mynode_stop_critical_services.sh reboot fi else diff --git a/rootfs/standard/usr/bin/mynode_post_upgrade.sh b/rootfs/standard/usr/bin/mynode_post_upgrade.sh index cdd5488e..2c36a567 100755 --- a/rootfs/standard/usr/bin/mynode_post_upgrade.sh +++ b/rootfs/standard/usr/bin/mynode_post_upgrade.sh @@ -9,10 +9,7 @@ set -e date # Shut down main services to save memory and CPU -systemctl stop electrs -systemctl stop lnd -systemctl stop quicksync -systemctl stop bitcoind +/usr/bin/mynode_stop_critical_services.sh # Check if any dpkg installs have failed and correct dpkg --configure -a diff --git a/rootfs/standard/usr/bin/mynode_stop_critical_services.sh b/rootfs/standard/usr/bin/mynode_stop_critical_services.sh new file mode 100755 index 00000000..507759b0 --- /dev/null +++ b/rootfs/standard/usr/bin/mynode_stop_critical_services.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Stop additional services +systemctl stop glances +systemctl stop lndhub +systemctl stop netdata +systemctl stop glances +systemctl stop rtl +systemctl stop webssh2 + +# Stop core services +systemctl stop electrs +systemctl stop lnd +systemctl stop quicksync +systemctl stop bitcoind + +sync \ No newline at end of file diff --git a/rootfs/standard/var/www/mynode/device_info.py b/rootfs/standard/var/www/mynode/device_info.py index bf90b926..65b237db 100644 --- a/rootfs/standard/var/www/mynode/device_info.py +++ b/rootfs/standard/var/www/mynode/device_info.py @@ -214,16 +214,14 @@ def delete_lnd_data(): def reboot_device(): - stop_bitcoind() - stop_lnd() os.system("sync") + os.system("/usr/bin/mynode_stop_critical_services.sh") os.system("reboot") def shutdown_device(): - stop_bitcoind() - stop_lnd() os.system("sync") + os.system("/usr/bin/mynode_stop_critical_services.sh") os.system("shutdown -h now")