A script to schedule nightly bittorrent downloads using the shell.
I needed this, because my Internet service provider limits my downloads outside the hours of midnight & 8:00.
The following script will start/stop bittorrent downloads nightly until the download is complete.
First we need bittorrent:
create a directory in your home folder & change directory into it:
sudo apt-get install bittorrent
create the following files:
mkdir ~/torrents ; cd ~/torrents
make them executable:
touch schedule.sh ; touch reschedule.sh
Edit schedule.sh & paste the following:
chmod +x schedule.sh ; chmod +x reschedule.sh
Note: Use your own time for starting/stopping.
echo "btlaunchmany ~/torrents > ~/torrents/torrent.log" | at midnight
echo ~/torrents/reschedule.sh | at 8:00
Edit reschedule.sh & paste the following:
Note: The 'Torrent is completed' email line is optional & will only work if mailx is configured.
if grep 100% ~/torrents/torrent.log > /dev/null
echo "Torrent has completed." | mailx -s "Torrent Complete" firstname.lastname@example.org
Now you can drop your .torrent file into the torrents directory & to start, run:
Note: This script has only been tested for a single bittorrent download at a time.
I hope this helps someone.