FreeNAS - EP4 - Advanced Bittorrent
Episode Number:
4 Show Notes and Links:
-
Enabling Transmission (bittorrent client)
- Navigate Chrome to FreeNAS URL and login
- Navigate to Services -> Bittorrent
- Check the Enable box
- Go over each options and explain their meaning and recommended settings
-
Add system variables to enable Transmission's blocklist
- Navigate to System -> Advanced -> rc.conf tab
- transmission_blocklist=YES
- transmission_noblocklist=NO
-
Create Blocklist Updating Script
- Navigate to: http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=60&t=519&st=0&sk=t&sd=a&start=20#p5515
- Copy and save the script locally
-
Transfer the script over to a directory
- NOTE: account has to be in staff group to edit
- Navigate to Advanced -> Command
-
Change permissions on the script to be executable
- chmod 774 /path/to/update_script.sh
-
Change owner and group to transmission:staff
- chown transmission:staff /path/to/update_script.sh
- NOTE: Write down the full path to the script, the cron tab doesn’t have a file browser
-
Add cron job for script
- Navigate to System -> Advanced -> Cron tab
- Add a job for the blacklist script (you can set whatever time/day you wish)
- Add cron jobs to set bandwidth limits
- Navigate to System -> Advanced -> Cron tab
- The command for unlimited upload/download is: /usr/local/bin/transmission-remote --no-uplimit --no-downlimit --auth admin:xxxxxxxx
- The command for limited upload is: /usr/local/bin/transmission-remote --uplimit 2 --downlimit 95 --auth admin:xxxxxxxx
- NOTE: switches require double dashes “--”
-
NOTE: Transmission uses KiloBYTES for up and down limits. Adjust your numbers accordingly.
- i.e. I usually have a 10Kbps limit, that would roughly be 2 KBps.
-
Change owners on Transmission directories
- Navigate to Advanced -> Command
-
Execute the following:
- chown -R transmission $(xml sel -T -t -v "/freenas/bittorrent/downloaddir" /conf/config.xml)
- chown -R transmission $(xml sel -T -t -v "/freenas/bittorrent/configdir" /conf/config.xml)
-
Change Group Permissions on Download Directory
- Navigate to Advanced -> File Manager
- Log in with your designated admin account for the WebUI
- Navigate to where your download directory is located
- In the Perm’s column for the directory row, click the permission mask (drwxr-xr-x)
- Check the Write box for Group
Followed this quide, though I used a different update script due to recommendations in the forum post - http://ejesconsulting.wordpress.com/2009/07/20/bittorrents-in-freenas/
Update owner for dirs: http://sourceforge.net/apps/phpbb/freenas/viewtopic.php?f=60&t=853
Blocklist Update Script
!/bin/sh
# 2009-02-20
PATH=/bin:/sbin:/usr/bin:/usr/local/bin; export PATH;
URL=http://download.m0k.org/transmission/files/level1.gz
DIR=`xml sel -T -t -v "/freenas/bittorrent/configdir" /conf/config.xml`
cd ${DIR}blocklists/
# Get local file size
LocalSize=`stat -qf %z ${URL##*/}`
# Get remote file size or exit
RemoteSize=`fetch -apsw 5 ${URL} || exit 1;`
# If local file size not equal to remote file size update blocklist
if [ ${LocalSize:-0} -ne ${RemoteSize} ]; then
fetch -apw 5 $URL && \
gzip -dfkq ${URL##*/} && \
echo "Blocklists updated on: $(date)" >> ${DIR}transmission_blocklists.log && \
/etc/rc.d/transmission restart
else
echo "No update available now: `date`"
fi
exit 0
Video Download: