mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 22:58:43 +01:00
#24 added to Service Menu
This commit is contained in:
parent
19d0843c18
commit
78e9fa7126
3 changed files with 46 additions and 5 deletions
|
@ -11,6 +11,7 @@ if [ ${#autoUnlock} -eq 0 ]; then autoUnlock="off"; fi
|
|||
if [ ${#runBehindTor} -eq 0 ]; then runBehindTor="off"; fi
|
||||
if [ ${#rtlWebinterface} -eq 0 ]; then rtlWebinterface="off"; fi
|
||||
if [ ${#chain} -eq 0 ]; then chain="main"; fi
|
||||
if [ ${#backupTorrentSeeding} -eq 0 ]; then backupTorrentSeeding="off"; fi
|
||||
|
||||
echo "map chain to on/off"
|
||||
chainValue="off"
|
||||
|
@ -41,6 +42,7 @@ CHOICES=$(dialog --title ' Additional Services ' --checklist ' use spacebar to a
|
|||
4 'Run behind TOR' ${runBehindTor} \
|
||||
5 'RTL Webinterface' ${rtlWebinterface} \
|
||||
6 'LND Auto-Unlock' ${autoUnlock} \
|
||||
7 'Backup Torrent Seeding' ${backupTorrentSeeding} \
|
||||
2>&1 >/dev/tty)
|
||||
dialogcancel=$?
|
||||
echo "done dialog"
|
||||
|
@ -213,6 +215,24 @@ else
|
|||
echo "LND Autounlock Setting unchanged."
|
||||
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
|
||||
dialog --pause "Hint: Use Spacebar to check/uncheck services." 8 58 5
|
||||
exit 0
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
# 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.
|
||||
# START with parameter "backup-torrent-hosting-cleanup" to stop background torrents and clean up
|
||||
|
||||
## get basic info
|
||||
source /home/admin/raspiblitz.info
|
||||
|
@ -44,9 +45,21 @@ sudo mkdir ${sessionDir}/update/ 2>/dev/null
|
|||
|
||||
# BACKUP TORRENT SEEDING
|
||||
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 ..."
|
||||
sudo rm -r /home/admin/.rtorrent.session 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
|
||||
fi
|
||||
|
||||
|
@ -106,10 +119,20 @@ if [ ${torrentComplete2} -eq 0 ]; then
|
|||
fi
|
||||
sleep 2
|
||||
|
||||
##############################
|
||||
# BACKUP TORRENT SEEDING
|
||||
##############################
|
||||
# just let torrent start and run in the background
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
|
|
|
@ -442,8 +442,6 @@ sudo /home/admin/config.scripts/blitz.stresstest.sh /home/admin/stresstest.repor
|
|||
if [ "${backupTorrentSeeding}" == "on" ]; then
|
||||
echo "Starting BACKUP TORRENT HOSTING in background ..." >> $logFile
|
||||
sudo /home/admin/50torrentHDD.sh backup-torrent-hosting
|
||||
sleep 5
|
||||
|
||||
fi
|
||||
|
||||
echo "DONE BOOTSTRAP" >> $logFile
|
||||
|
|
Loading…
Add table
Reference in a new issue