Improve enable/disable restoration

This commit is contained in:
Taylor Helsper 2020-01-16 22:22:31 -06:00
parent 1eaf2b4ff2
commit d272f7364f
4 changed files with 24 additions and 2 deletions

View File

@ -15,7 +15,7 @@ if [ ! -h /etc/resolv.conf ]; then
rm -f /etc/resolv.conf
touch /etc/resolvconf/run/resolv.conf
ln -s /etc/resolvconf/run/resolv.conf /etc/resolv.conf
sync
reboot
sleep 10s
@ -45,7 +45,7 @@ if [ ! -f /var/lib/mynode/.expanded_rootfs ]; then
fi
fi
# Verify we are in a clean state (only raspi uses HDD swap)
# Verify we are in a clean state
if [ $IS_RASPI -eq 1 ] || [ $IS_ROCKPRO64 -eq 1 ]; then
dphys-swapfile swapoff || true
dphys-swapfile uninstall || true
@ -290,6 +290,18 @@ if [ -f $BTCRPCEXPLORER_ENABLED_FILE ]; then
STARTUP_MODIFIED=1
fi
fi
if [ -f $MEMPOOLSPACE_ENABLED_FILE ]; then
if systemctl status mempoolspace | grep "disabled;"; then
systemctl enable mempoolspace
STARTUP_MODIFIED=1
fi
fi
if [ -f $BTCPAYSERVER_ENABLED_FILE ]; then
if systemctl status btcpayserver | grep "disabled;"; then
systemctl enable btcpayserver
STARTUP_MODIFIED=1
fi
fi
if [ -f $VPN_ENABLED_FILE ]; then
if systemctl status vpn | grep "disabled;"; then
systemctl enable vpn

View File

@ -67,6 +67,8 @@ ELECTRS_ENABLED_FILE="/mnt/hdd/mynode/.mynode_electrs_enabled"
LNDHUB_ENABLED_FILE="/mnt/hdd/mynode/.mynode_lndhub_enabled"
BTCRPCEXPLORER_ENABLED_FILE="/mnt/hdd/mynode/.mynode_btcrpceplorer_enabled"
VPN_ENABLED_FILE="/mnt/hdd/mynode/.mynode_vpn_enabled"
MEMPOOLSPACE_ENABLED_FILE="/mnt/hdd/mynode/.mynode_mempoolspace_enabled"
BTCPAYSERVER_ENABLED_FILE="/mnt/hdd/mynode/.mynode_btcpayserver_enabled"
BITCOIN_SYNCED_FILE="/mnt/hdd/mynode/.mynode_bitcoind_synced"
QUICKSYNC_COMPLETE_FILE="$QUICKSYNC_DIR/.quicksync_complete"

View File

@ -25,3 +25,5 @@ LNDHUB_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_lndhub_enabled"
BTCRPCEXPLORER_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_btcrpceplorer_enabled"
VPN_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_vpn_enabled"
NETDATA_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_netdata_enabled"
MEMPOOLSPACE_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_mempoolspace_enabled"
BTCPAYSERVER_ENABLED_FILE = "/mnt/hdd/mynode/.mynode_btcpayserver_enabled"

View File

@ -65,8 +65,11 @@ def is_mempoolspace_enabled():
def enable_mempoolspace():
os.system("systemctl enable mempoolspace --no-pager")
os.system("systemctl start mempoolspace --no-pager")
open(MEMPOOLSPACE_ENABLED_FILE, 'a').close() # touch file
def disable_mempoolspace():
if os.path.isfile(MEMPOOLSPACE_ENABLED_FILE):
os.remove(MEMPOOLSPACE_ENABLED_FILE)
os.system("systemctl stop mempoolspace --no-pager")
os.system("systemctl disable mempoolspace --no-pager")
@ -77,8 +80,11 @@ def is_btcpayserver_enabled():
def enable_btcpayserver():
os.system("systemctl enable btcpayserver --no-pager")
os.system("systemctl start btcpayserver --no-pager")
open(BTCPAYSERVER_ENABLED_FILE, 'a').close() # touch file
def disable_btcpayserver():
if os.path.isfile(BTCPAYSERVER_ENABLED_FILE):
os.remove(BTCPAYSERVER_ENABLED_FILE)
os.system("systemctl stop btcpayserver --no-pager")
os.system("systemctl disable btcpayserver --no-pager")