From 3f9719b1b41db89275bfb8e7e4aa8c1877accde6 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Mon, 15 Apr 2019 12:34:14 +0100 Subject: [PATCH] background task controls torrent --- home.admin/_background.sh | 26 ++++++++++++++++---------- home.admin/_bootstrap.sh | 9 --------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/home.admin/_background.sh b/home.admin/_background.sh index 98fa48f09..c94e39662 100644 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -172,22 +172,28 @@ do actualSecondsTimestamp=$(date +%s) secondsInSync=$(echo "${actualSecondsTimestamp}-"${syncedSince} | bc) echo "${secondsInSync} seconds" - if [ "${backupTorrentSeeding}" == "on" ]; then - echo "Backup Torrent Seeding is ON - check if already running" - source <(sudo -u admin /home/admin/50torrentHDD.sh status) - if [ "${baseSeeding}" == "0" ] || [ "${updateSeeding}" == "0" ]; then - echo "---> STARTING Backup Torrent Seeding" - sudo -u admin /home/admin/50torrentHDD.sh backup-torrent-hosting + + # when >10min in sync + if [ ${secondsInSync} -gt 600 ]; then + echo "LND in sync for longer then 10 minutes" + if [ "${backupTorrentSeeding}" == "on" ]; then + echo "Backup Torrent Seeding is ON - check if already running" + source <(sudo -u admin /home/admin/50torrentHDD.sh status) + if [ "${baseSeeding}" == "0" ] || [ "${updateSeeding}" == "0" ]; then + echo "---> STARTING Backup Torrent Seeding" + sudo -u admin /home/admin/50torrentHDD.sh backup-torrent-hosting + else + echo "Backup Torrent Seeding - already running" + fi else - echo "Backup Torrent Seeding - already running" + echo "Backup Torrent Seeding is OFF" fi - else - echo "Backup Torrent Seeding is OFF" fi + else echo "still not in sync" if [ ${syncedSince} -gt 0 ]; then - + echo "was in sync at least once since rinning but lost now for:" actualSecondsTimestamp=$(date +%s) secondsOutOfSync=$(echo "${actualSecondsTimestamp}-"${syncedSince} | bc) diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index acc495605..078fd6a71 100644 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -435,14 +435,5 @@ sed -i "s/^state=.*/state=stresstest/g" ${infoFile} sed -i "s/^message=.*/message='Testing Hardware 60s'/g" ${infoFile} sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.report -################################ -# BACKUP TORRENT SEEDING -################################ - -if [ "${backupTorrentSeeding}" == "on" ]; then - echo "Starting BACKUP TORRENT HOSTING in background (after 6 hours) ..." >> $logFile - ( sleep 6h ; sudo -u admin /home/admin/50torrentHDD.sh backup-torrent-hosting ) & -fi - echo "DONE BOOTSTRAP" >> $logFile exit 0 \ No newline at end of file