Setting up a headless torrent daemon in FreeBSD en

By drm on Wednesday 14 April 2010 19:46 - Comments (9)
Categories: Linux / BSD, Tips, tips, tips ..., Views: 1.971

I have FreeBSD running as a home server for a while now. One of the things I wanted the server to take care of is downloading torrents, so I could shut down my PC whenever I am downloading stuff.

With transmission-daemon (net-p2p/transmission-daemon from ports) this is really simple. To install:
cd /usr/ports/net-p2p/transmission-daemon && make install clean

To fire up:
/usr/local/etc/rc.d/transmission onestart
or add transmission_enable=YES to your /etc/rc.conf and run
/usr/local/etc/rc.d/transmission start


There's a few gotcha's, though:

The settings file transmission uses lives in /usr/local/etc/transmission/home/settings.json. This file is overwritten by transmission on startup, so that isn't the place to put your custom configurations. After doing a bit of reading of the rc script (/usr/local/etc/rc.d/transmission), I found out that the easiest way to configure transmission-daemon for your needs is editing your /etc/rc.conf and adding a transmission_flags var. This var is passed as parameters to transmission-daemon, so check out
transmission-daemon --help
for available options.

My transmission rc config looks like this (in /etc/rc.conf):
transmission_enable=YES
transmission_flags="-a 192.168.178.*,127.0.0.* --incomplete-dir /var/spool/transmission -w /srv/files/download -e /var/log/transmission.log" --paused
  • -a makes sure both the web client (available at port 9091 when transmission-daemon is running) and the transmission-remote cli tool are accessible by the specified addresses
  • --incomplete-dir is used to store incomplete downloads while downloading.
  • -w is the "work" dir, where files are stored when completed, and while downloading if --incomplete-dir isn't running
  • -e tells transmission to log messages and warnings to /var/log/transmission, especially useful while configuring transmission or you're encountering errors
  • --paused makes sure the daemon is started, but all torrents are paused. You need to start the torrents manually by using either the web interface (running at port 9091 by default) or using the transmission-remote command line utility
I have created the necessary files and folders with the transmission user and group as the owner. As root:
install -d {/var/spool/transmission,/srv/files/download} -g transmission -u transmission -m 644
touch /var/log/transmission.log && chown transmission:transmission /var/log/transmission.log


As always, you need to restart the daemon after changing settings, so call
/usr/local/etc/rc.d/transmission restart
after doing your modifications to /etc/rc.conf.

Of course you need to make sure the drives the directories live in have enough space left, or you might run into some weird results.

Happy torrenting :)

My top 5 dos and don'ts of self-explanatory programming en

By drm on Monday 22 March 2010 19:16 - Comments (1)
Category: Development, Views: 720

I have gathered some of the less obvious do's and don'ts in how to make your code more explanatory to your coworkers. I left out the more obvious like writing doc-comments, using coding standards, etc. Those go without saying. This might be considered "drm's php tiplist revisited" ;)

Read more »

Twig, the next generation template engine for PHP en

By drm on Tuesday 09 February 2010 20:50 - Comments (9)
Category: Development, Views: 2.009

I've been using Smarty 2 for about 7 years, and, while Smarty 3 is still in beta, Twig just popped up in the scene. Notable Smarty opposer Fabien Potencier was apparently converted by this template engine, so Twig must either be magic, or excellent, or both.

Read more »

VirtualBox is more free than you might think en

By drm on Friday 05 February 2010 00:35 - Comments (14)
Categories: Development, Tips, tips, tips ..., Views: 3.471

I read a post today at the Zend Framework general mailinglist from Ralf Eggert, having trouble with Internet Explorer 6. As all of us developers know, IE6 is trouble.

Read more »

HipHop - The talk of the day en

By drm on Wednesday 03 February 2010 19:48 - Comments (15)
Categories: Development, Miscellaneous, Views: 2.108

Today I read about HipHop, the talk of the day in the PHP community. It is basically a PHP to C++ compiler, developed by Facebook to have all benefits of compiled binaries (improved performance, more efficient memory management, less overhead), without having to train their PHP developers into C++ developers or do a big round of fire-and-hire. They open sourced it today.

Read more »