#24 added to Service Menu

This commit is contained in:
Christian Rotzoll 2019-04-11 17:32:50 +01:00
parent 19d0843c18
commit 78e9fa7126
3 changed files with 46 additions and 5 deletions

View file

@ -11,6 +11,7 @@ if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
if [ ${#chain} -eq 0 ]; then chain="main"; fi if [ ${#chain} -eq 0 ]; then chain="main"; fi
if [ ${#backupTorrentSeeding} -eq 0 ]; then backupTorrentSeeding="off"; fi
echo "map chain to on/off" echo "map chain to on/off"
chainValue="off" chainValue="off"
@ -41,6 +42,7 @@ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to a
4 'Run behind TOR' ${runBehindTor} \ 4 'Run behind TOR' ${runBehindTor} \
5 'RTL Webinterface' ${rtlWebinterface} \ 5 'RTL Webinterface' ${rtlWebinterface} \
6 'LND Auto-Unlock' ${autoUnlock} \ 6 'LND Auto-Unlock' ${autoUnlock} \
7 'Backup Torrent Seeding' ${backupTorrentSeeding} \
2>&1 >/dev/tty) 2>&1 >/dev/tty)
dialogcancel=$? dialogcancel=$?
echo "done dialog" echo "done dialog"
@ -213,6 +215,24 @@ else
echo "LND Autounlock Setting unchanged." echo "LND Autounlock Setting unchanged."
fi fi
# Backup Torrent Seeding
choice="off"; check=$(echo "${CHOICES}" | grep -c "7")
if [ ${check} -eq 1 ]; then choice="on"; fi
if [ "${backupTorrentSeeding}" != "${choice}" ]; then
echo "BACKUP TORRENT SEEDING Setting changed .."
anychange=1
if [ "${choice}" = "on" ]; then
echo "BACKUP TORRENT SEEDING IS NOW ON"
else
echo "Stopping Torrents and Cleaning Up ..."
sudo /home/admin/50torrentHDD.sh backup-torrent-hosting-cleanup
echo "BACKUP TORRENT SEEDING IS NOW OFF"
fi
else
echo "LND Autounlock Setting unchanged."
fi
if [ ${anychange} -eq 0 ]; then if [ ${anychange} -eq 0 ]; then
dialog --pause "Hint: Use Spacebar to check/uncheck services." 8 58 5 dialog --pause "Hint: Use Spacebar to check/uncheck services." 8 58 5
exit 0 exit 0

View file

@ -2,6 +2,7 @@
# START with parameter "backup-torrent-hosting" to just kick of the torrent downloads in the background during # START with parameter "backup-torrent-hosting" to just kick of the torrent downloads in the background during
# regular RaspiBlitz running. So you support torrent hosting and have a blockchain backup ready just in case. # regular RaspiBlitz running. So you support torrent hosting and have a blockchain backup ready just in case.
# START with parameter "backup-torrent-hosting-cleanup" to stop background torrents and clean up
## get basic info ## get basic info
source /home/admin/raspiblitz.info source /home/admin/raspiblitz.info
@ -44,9 +45,21 @@ sudo mkdir ${sessionDir}/update/ 2>/dev/null
# BACKUP TORRENT SEEDING # BACKUP TORRENT SEEDING
if [ "$1" == "backup-torrent-hosting-cleanup" ]; then if [ "$1" == "backup-torrent-hosting-cleanup" ]; then
echo "Stopping Torrents ..."
sessionPID=$(screen -ls | grep "blockchain" | cut -d "." -f1 | xargs)
if [ ${#sessionPID} -gt 0 ]; then
sudo pkill -P ${sessionPID}
fi
sessionPID=$(screen -ls | grep "update" | cut -d "." -f1 | xargs)
if [ ${#sessionPID} -gt 0 ]; then
sudo pkill -P ${sessionPID}
fi
echo "Deleting all possible old (version) torrent data ..." echo "Deleting all possible old (version) torrent data ..."
sudo rm -r /home/admin/.rtorrent.session 2>/dev/null sudo rm -r /home/admin/.rtorrent.session 2>/dev/null
sudo rm -r /mnt/hdd/torrent 2>/dev/null sudo rm -r /mnt/hdd/torrent 2>/dev/null
echo "Changing config ..."
sudo sed -i "s/^backupTorrentSeeding=.*/backupTorrentSeeding=off/g" /mnt/hdd/raspiblitz.conf
echo "DONE"
exit exit
fi fi
@ -106,10 +119,20 @@ if [ ${torrentComplete2} -eq 0 ]; then
fi fi
sleep 2 sleep 2
##############################
# BACKUP TORRENT SEEDING # BACKUP TORRENT SEEDING
##############################
# just let torrent start and run in the background # just let torrent start and run in the background
if [ "$1" == "backup-torrent-hosting" ]; then if [ "$1" == "backup-torrent-hosting" ]; then
echo "Done BACKUP TORRENT HOSTING .." # changing config - so it can be startup again after a reboot by bootstrap
source /mnt/hdd/raspiblitz.conf
if [ ${#backupTorrentSeeding} -eq 0 ]; then
echo "backupTorrentSeeding=on" >> /mnt/hdd/raspiblitz.conf
else
sudo sed -i "s/^backupTorrentSeeding=.*/backupTorrentSeeding=on/g" /mnt/hdd/raspiblitz.conf
fi
echo "Done BACKUP TORRENT HOSTING"
exit exit
fi fi

View file

@ -440,10 +440,8 @@ sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.repor
################################ ################################
if [ "${backupTorrentSeeding}" == "on" ]; then if [ "${backupTorrentSeeding}" == "on" ]; then
echo "Starting BACKUP TORRENT HOSTING in background ..." >> $logFile echo "Starting BACKUP TORRENT HOSTING in background ..." >> $logFile
sudo /home/admin/50torrentHDD.sh backup-torrent-hosting sudo /home/admin/50torrentHDD.sh backup-torrent-hosting
sleep 5
fi fi
echo "DONE BOOTSTRAP" >> $logFile echo "DONE BOOTSTRAP" >> $logFile