Move status file to /tmp

This commit is contained in:
Taylor Helsper 2020-08-21 13:31:47 -05:00
parent ffb8bc0bae
commit 2aa224c57c
7 changed files with 14 additions and 13 deletions

View File

@ -68,13 +68,13 @@ proc createMyNodeFsOnBlockDevice {blockDevice} {
if [catch { if [catch {
puts "Waiting on format confirmation..." puts "Waiting on format confirmation..."
runCommand echo "drive_format_confirm" > /mnt/hdd/mynode/.mynode_status runCommand echo "drive_format_confirm" > /tmp/.mynode_status
while { [file exists "/tmp/format_ok"] == 0 } { while { [file exists "/tmp/format_ok"] == 0 } {
after 500 after 500
} }
puts "Creating new partition table on ${blockDevice}" puts "Creating new partition table on ${blockDevice}"
runCommand echo "drive_formatting" > /mnt/hdd/mynode/.mynode_status runCommand echo "drive_formatting" > /tmp/.mynode_status
runCommand /usr/bin/format_drive.sh ${blockDevice} runCommand /usr/bin/format_drive.sh ${blockDevice}
after 5000 after 5000

View File

@ -31,7 +31,7 @@ while [ -f /mnt/hdd/mynode/settings/quicksync_disabled ]; do
sync sync
# Give Bitcoin a couple minutes to start # Give Bitcoin a couple minutes to start
sleep 120s sleep 120s
echo "stable" > $MYNODE_DIR/.mynode_status echo "stable" > $MYNODE_STATUS_FILE
sync sync
sleep 10d sleep 10d
done done
@ -39,7 +39,7 @@ done
# Make sure folder exists # Make sure folder exists
mkdir -p $QUICKSYNC_DIR mkdir -p $QUICKSYNC_DIR
if [ ! -f $QUICKSYNC_DIR/.quicksync_download_complete ]; then if [ ! -f $QUICKSYNC_DIR/.quicksync_download_complete ]; then
echo "quicksync_download" > $MYNODE_DIR/.mynode_status echo "quicksync_download" > $MYNODE_STATUS_FILE
fi fi
echo "Starting quicksync..." echo "Starting quicksync..."
@ -50,7 +50,7 @@ if [ ! -f $QUICKSYNC_DIR/.quicksync_complete ] && [ -f $QUICKSYNC_DIR/.quicksync
fi fi
# Check if quicksync was completed # Check if quicksync was completed
if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then
echo "stable" > $MYNODE_DIR/.mynode_status echo "stable" > $MYNODE_STATUS_FILE
fi fi
# Download torrent # Download torrent

View File

@ -14,7 +14,7 @@ touch $QUICKSYNC_DIR/.quicksync_download_complete
sync sync
# Copy files # Copy files
echo "quicksync_copy" > $MYNODE_DIR/.mynode_status echo "quicksync_copy" > $MYNODE_STATUS_FILE
rm -rf $MYNODE_DIR/bitcoin/blocks/ rm -rf $MYNODE_DIR/bitcoin/blocks/
rm -rf $MYNODE_DIR/bitcoin/chainstate/ rm -rf $MYNODE_DIR/bitcoin/chainstate/
tar -xvf $QUICKSYNC_DIR/blockchain*.tar.gz -C $MYNODE_DIR/bitcoin/ --dereference 2>&1 > /tmp/tar_log_$(date +%s) tar -xvf $QUICKSYNC_DIR/blockchain*.tar.gz -C $MYNODE_DIR/bitcoin/ --dereference 2>&1 > /tmp/tar_log_$(date +%s)
@ -27,7 +27,7 @@ sleep 30s
touch $QUICKSYNC_DIR/.quicksync_complete touch $QUICKSYNC_DIR/.quicksync_complete
sync sync
sleep 5m sleep 5m
echo "stable" > $MYNODE_DIR/.mynode_status echo "stable" > $MYNODE_STATUS_FILE
sync sync
exit 0 exit 0

View File

@ -97,7 +97,7 @@ set -e
while [ ! -f /mnt/hdd/.mynode ] while [ ! -f /mnt/hdd/.mynode ]
do do
# Clear status # Clear status
rm -f $MYNODE_DIR/.mynode_status rm -f $MYNODE_STATUS_FILE
mount_drive.tcl || true mount_drive.tcl || true
sleep 5 sleep 5
done done
@ -131,8 +131,8 @@ mkdir -p /mnt/hdd/mynode/whirlpool
mkdir -p /mnt/hdd/mynode/lnbits mkdir -p /mnt/hdd/mynode/lnbits
mkdir -p /mnt/hdd/mynode/specter mkdir -p /mnt/hdd/mynode/specter
mkdir -p /tmp/flask_uploads mkdir -p /tmp/flask_uploads
echo "drive_mounted" > $MYNODE_DIR/.mynode_status echo "drive_mounted" > $MYNODE_STATUS_FILE
chmod 777 $MYNODE_DIR/.mynode_status chmod 777 $MYNODE_STATUS_FILE
rm -rf $MYNODE_DIR/.mynode_bitcoind_synced rm -rf $MYNODE_DIR/.mynode_bitcoind_synced
@ -488,5 +488,5 @@ torify wget $LATEST_BETA_VERSION_URL -O /usr/share/mynode/latest_beta_version ||
# Update current state # Update current state
if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then if [ -f $QUICKSYNC_DIR/.quicksync_complete ]; then
echo "stable" > $MYNODE_DIR/.mynode_status echo "stable" > $MYNODE_STATUS_FILE
fi fi

View File

@ -43,6 +43,7 @@ SERIAL_NUM=$(mynode-get-device-serial)
# Set all default / standard bash config settings # Set all default / standard bash config settings
MYNODE_DIR=/mnt/hdd/mynode MYNODE_DIR=/mnt/hdd/mynode
MYNODE_STATUS_FILE=/tmp/.mynode_status
VPN_BACKUP_DIR=/mnt/hdd/mynode/vpn VPN_BACKUP_DIR=/mnt/hdd/mynode/vpn
QUICKSYNC_DIR=/mnt/hdd/mynode/quicksync QUICKSYNC_DIR=/mnt/hdd/mynode/quicksync
QUICKSYNC_CONFIG_DIR=/mnt/hdd/mynode/.config/transmission QUICKSYNC_CONFIG_DIR=/mnt/hdd/mynode/.config/transmission

View File

@ -454,7 +454,7 @@ def stop_quicksync():
os.system("systemctl stop quicksync") os.system("systemctl stop quicksync")
def restart_quicksync(): def restart_quicksync():
os.system('echo "quicksync_reset" > /mnt/hdd/mynode/.mynode_status') os.system('echo "quicksync_reset" > /tmp/.mynode_status')
stop_bitcoind() stop_bitcoind()
stop_quicksync() stop_quicksync()
delete_bitcoin_data() delete_bitcoin_data()

View File

@ -99,7 +99,7 @@ threads = []
### Helper functions ### Helper functions
def get_status(): def get_status():
try: try:
status_file = "/mnt/hdd/mynode/.mynode_status" status_file = "/tmp/.mynode_status"
status = STATE_UNKNOWN status = STATE_UNKNOWN
# If its been a while, check for error conditions # If its been a while, check for error conditions