Add hook script capabilities
This commit is contained in:
parent
91c072e959
commit
4fec221654
|
@ -9,6 +9,7 @@ source /usr/share/mynode/mynode_app_versions.sh
|
||||||
# NOTE: Background services will run before mynode service completes, so a drive MAY NOT be attached
|
# NOTE: Background services will run before mynode service completes, so a drive MAY NOT be attached
|
||||||
|
|
||||||
COUNTER=0
|
COUNTER=0
|
||||||
|
BITCOIN_SYNCED=0
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
|
@ -31,6 +32,16 @@ while true; do
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Custom startup hook - post-bitcoin-synced
|
||||||
|
if [ -f /usr/local/bin/mynode_hook_post_bitcoin_synced.sh ]; then
|
||||||
|
if [ $BITCOIN_SYNCED == 0 ] && [ -f $BITCOIN_SYNCED_FILE ]; then
|
||||||
|
/bin/bash /usr/local/bin/mynode_hook_post_bitcoin_synced.sh || true
|
||||||
|
BITCOIN_SYNCED=1
|
||||||
|
else
|
||||||
|
BITCOIN_SYNCED=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Increment counter and sleep 1 min
|
# Increment counter and sleep 1 min
|
||||||
COUNTER=$((COUNTER+1))
|
COUNTER=$((COUNTER+1))
|
||||||
|
|
|
@ -136,6 +136,10 @@ fi
|
||||||
rm -f /tmp/repairing_drive
|
rm -f /tmp/repairing_drive
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Custom startup hook - pre-startup
|
||||||
|
if [ -f /usr/local/bin/mynode_hook_pre_startup.sh ]; then
|
||||||
|
/bin/bash /usr/local/bin/mynode_hook_pre_startup.sh || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Mount HDD (normal boot, format if necessary)
|
# Mount HDD (normal boot, format if necessary)
|
||||||
while [ ! -f /mnt/hdd/.mynode ]
|
while [ ! -f /mnt/hdd/.mynode ]
|
||||||
|
@ -790,9 +794,10 @@ if [ -f /usr/share/joininbox/menu.update.sh ] && [ -f /home/joinmarket/menu.upda
|
||||||
fi
|
fi
|
||||||
chown bitcoin:bitcoin /mnt/hdd/mynode/settings/.lndpw || true
|
chown bitcoin:bitcoin /mnt/hdd/mynode/settings/.lndpw || true
|
||||||
|
|
||||||
# Check for new versions
|
# Custom startup hook - post-startup
|
||||||
torify wget $LATEST_VERSION_URL --timeout=30 -O /usr/share/mynode/latest_version || true
|
if [ -f /usr/local/bin/mynode_hook_post_startup.sh ]; then
|
||||||
torify wget $LATEST_BETA_VERSION_URL --timeout=30 -O /usr/share/mynode/latest_beta_version || true
|
/bin/bash /usr/local/bin/mynode_hook_post_startup.sh || true
|
||||||
|
fi
|
||||||
|
|
||||||
# Update current state
|
# Update current state
|
||||||
if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then
|
if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then
|
||||||
|
|
|
@ -110,7 +110,7 @@ def update_bitcoin_main_info_thread():
|
||||||
bitcoin_block_height = get_bitcoin_block_height()
|
bitcoin_block_height = get_bitcoin_block_height()
|
||||||
mynode_block_height = get_mynode_block_height()
|
mynode_block_height = get_mynode_block_height()
|
||||||
remaining = bitcoin_block_height - mynode_block_height
|
remaining = bitcoin_block_height - mynode_block_height
|
||||||
if remaining == 0 and bitcoin_block_height > 680000:
|
if remaining == 0 and bitcoin_block_height > 710000:
|
||||||
synced = True
|
synced = True
|
||||||
if not os.path.isfile(BITCOIN_SYNCED_FILE):
|
if not os.path.isfile(BITCOIN_SYNCED_FILE):
|
||||||
open(BITCOIN_SYNCED_FILE, 'a').close() # touch file
|
open(BITCOIN_SYNCED_FILE, 'a').close() # touch file
|
||||||
|
|
Loading…
Reference in New Issue
Block a user