mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 00:19:15 +00:00
Improve uploader toggle
This commit is contained in:
parent
d7d35d9804
commit
2f5846ae2a
|
@ -18,6 +18,11 @@ cp -f /usr/share/quicksync/settings.json $QUICKSYNC_CONFIG_DIR/settings.json
|
|||
# Wait a bit for boot to complete
|
||||
sleep 15s
|
||||
|
||||
# If marked as uploader, make sure QuickSync is enabled
|
||||
if [ -f $UPLOADER_FILE ]; then
|
||||
rm /mnt/hdd/mynode/settings/quicksync_disabled || true
|
||||
fi
|
||||
|
||||
# Check if quicksync was disabled
|
||||
while [ -f /mnt/hdd/mynode/settings/quicksync_disabled ]; do
|
||||
# Pretend quicksync step is complete
|
||||
|
|
|
@ -2,11 +2,16 @@
|
|||
|
||||
source /usr/share/mynode/mynode_config.sh
|
||||
|
||||
sleep 1m
|
||||
|
||||
echo "Waiting until QuickSync is complete..."
|
||||
while [ ! -f "$QUICKSYNC_COMPLETE_FILE" ]; do
|
||||
sleep 1h
|
||||
done
|
||||
|
||||
# No need to check for new torrent right away
|
||||
sleep 2m
|
||||
|
||||
while true; do
|
||||
# Wait a while... we don't want everyone starting on a new torrent at once
|
||||
if [ -f $UPLOADER_FILE ]; then
|
||||
|
@ -24,7 +29,8 @@ while true; do
|
|||
cmp --silent /tmp/blockchain_temp.torrent $QUICKSYNC_DIR/blockchain.torrent || NEW_TORRENT=1
|
||||
if [ $NEW_TORRENT -eq 1 ]; then
|
||||
# Reboot to restart and get new torrent
|
||||
reboot
|
||||
sleep 30s
|
||||
reboot
|
||||
else
|
||||
echo "Torrent has not changed."
|
||||
fi
|
||||
|
|
|
@ -243,13 +243,10 @@ def get_journalctl_log(service_name):
|
|||
# Uploader Functions
|
||||
#==================================
|
||||
def is_uploader():
|
||||
return os.path.isfile("/home/bitcoin/.mynode/uploader") or \
|
||||
os.path.isfile("/mnt/hdd/mynode/settings/uploader")
|
||||
return os.path.isfile("/mnt/hdd/mynode/settings/uploader")
|
||||
def set_uploader():
|
||||
os.system("touch /home/bitcoin/.mynode/uploader")
|
||||
os.system("touch /mnt/hdd/mynode/settings/uploader")
|
||||
def unset_uploader():
|
||||
os.system("rm -rf /home/bitcoin/.mynode/uploader")
|
||||
os.system("rm -rf /mnt/hdd/mynode/settings/uploader")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user