Headless Mac Torrent Download-Server?

Ask for help and report issues with the Mac OS X version of Transmission
MirandaPanda
Posts: 3
Joined: Tue Apr 28, 2009 2:51 pm

Headless Mac Torrent Download-Server?

Post by MirandaPanda »

I would like to use transmission to provide a bittorrent download server for our workgroup using one of our workstation macs. since the logged in users on the workstation mac change i can not just let one Transmission.app open, i suppose. Any Ideas?
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Headless Mac Torrent Download-Server?

Post by Jordan »

Use transmission-daemon as the headless download engine, and connect to it with a web browser.
rb07
Posts: 1400
Joined: Sun Aug 24, 2008 3:14 am

Re: Headless Mac Torrent Download-Server?

Post by rb07 »

MirandaPanda wrote:I would like to use transmission to provide a bittorrent download server for our workgroup using one of our workstation macs. since the logged in users on the workstation mac change i can not just let one Transmission.app open, i suppose. Any Ideas?
If you mean server for your own files/torrents, then you need to install a tracker so the others can connect to your (private) server, and make/distribute your own custom .torrent files. Something like http://xbtt.sourceforge.net/tracker/ which is very good BTW.

If you meant using one torrent client for several users, then its just like Jordan said. Add a different Web interface if you want users to see only their torrents and not everybody's downloads. Something like http://www.torrentflux.com/ and there are others.
MirandaPanda
Posts: 3
Joined: Tue Apr 28, 2009 2:51 pm

Re: Headless Mac Torrent Download-Server?

Post by MirandaPanda »

So how do I install transmission-daemon on a Mac?
MirandaPanda
Posts: 3
Joined: Tue Apr 28, 2009 2:51 pm

Re: Headless Mac Torrent Download-Server?

Post by MirandaPanda »

Nobdy has an idea or a tip for me?
Yada
Posts: 273
Joined: Sat Apr 01, 2006 8:53 am
Location: Netherlands

Re: Headless Mac Torrent Download-Server?

Post by Yada »

I would be interested in this as well. I also would like to know if the daemon requires Leopard.
Jordan
Transmission Developer
Posts: 2312
Joined: Sat May 26, 2007 3:39 pm
Location: Titania's Room

Re: Headless Mac Torrent Download-Server?

Post by Jordan »

I don't know whether or not we do a mac build of the daemon or not... that would be a BentMyWookie question.

However I can say it doesn't require any particular version of OS X.
guilherme
Posts: 51
Joined: Thu Jan 22, 2009 6:04 pm

Re: Headless Mac Torrent Download-Server?

Post by guilherme »

The daemon can be built on OS X using MacPorts, though it's not easy and/or quick. You have to install MacPorts, then the transmission-x11 (aka GTK) port and just then compile transmission from source (svn or not) so you can run it.

Quick-steps: download and install XCode, install MacPorts, search for the Transmission-X11 port, install it, then just compile Transmission as described on the wiki (stable, beta or svn - whichever fits your needs ;D). Default installation path is /opt/local/

PS: compiling the transmission-x11 port first is just a lazy way of downloading, compiling and installing transmission's dependencies =). This way you leave the hard work for MacPorts and not for your fingers ;)
ryanv
Posts: 4
Joined: Fri Jun 19, 2009 8:02 am

Re: Headless Mac Torrent Download-Server?

Post by ryanv »

Jordan wrote:...However I can say it doesn't require any particular version of OS X.
When running transmission-daemon on 10.4 I get the following error:

Code: Select all

dyld: Symbol not found: _read$UNIX2003
  Referenced from: /mnt/Scratch/Users/frontrow/Downloads/./transmission-daemon
  Expected in: /usr/lib/libSystem.B.dylib
Using CFLAGS="-O -g -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" causes serious errors. Any suggestions?
chorlya
Posts: 11
Joined: Fri Jan 16, 2009 12:16 pm

Re: Headless Mac Torrent Download-Server?

Post by chorlya »

I'm running transmission-daemon (TD) on Leopard for a while now, and its actually not that complicated to get up and running. I don't have MacPorts installed, so you don't need it either.

NOTES:
1. Transmission 1.72 doesn't build for me on Leopard (that is why I came to this forum in the first place :) ) However, 1.6x works great for me, so you should probably try that version for now.
2. TD will pickup .torrent files form your regular installation of Transmission.app for that user. This happens some times, other times not. I'm not sure if this should happen at all or not, but its not what I want so I wrote a small script to get around that. If somebody needs that script, I'll post it here later.

I have Xcode 3.1.2 installed, and that's all I use to build TD.

Here are the steps to take to build and setup TD on OS X:
1. Install Xcode 3.1.1 or newer
2. Download Transmission source archive (one ending in .tar.bz2)
3. Unpack the downloaded source archive and navigate to that newly created directory
4. Double click "Transmission.xcodeproj" file to open it in Xcode
5. Once in Xcode, expand the combo box in top left corner of the window and select "transmission-daemon" option. In the box next to it, you can select if you want Release or Debug build. I have Debug selected, but it shouldn't really matter what you choose.
6. Click the "Build" button (hammer icon), located left from those two combo boxes, and wait for the build to finish. You can watch the progress of the build in the lower right corner of the window
7. Now go back to Finder window where "Transmission.xcodeproj" is located, and navigate to "build" directory within it. Now you should have one of Release or Debug directories, depending on what build type you choose in step 5. Ignore other directories, and navigate to your Release or Debug directory. There you should have file named "transmission-daemon".
8. Optionally copy that "transmission-daemon" to someplace on your path if you want to start it from Terminal, which you most likely will want to do at least while configuring it. This copy operation is usually best done via a Terminal command like "sudo cp /path/to/transmission-dameon /usr/local/bin" (without quotes, of course).
9. Go back to directory where "Transmission.xcodeproj" is located and then copy complete "web" directory to some place permanent. I copied it to /Users/<username>/Library/Application Support/transmission-daemon/, but any other place you have permission should work just as well.
10. Now you need to set environment variable named "TRANSMISSION_WEB_HOME" to point to that place where you copied web directory in previous step. You can do that in Terminal with command like "export TRANSMISSION_WEB_HOME=/Users/<username>/Library/Application\ Support/transmission-daemon/web". This will only last as long as your current Terminal window's session. Once you have it all working, you'll probably want to to have it permanently set. To do that, just copy that export line into your "~/.bash_profile" file.

Now you have it all in place and you need to start transmission-daemon from Terminal and set it up to suit your needs. You should probably read its man page first or just run it with "transmission-daemon -h" to see all available options.

Try it and let us know how it goes. I think you'll be happy with it, just like I am.

Post here if you run into some problems.
ryanv
Posts: 4
Joined: Fri Jun 19, 2009 8:02 am

Re: Headless Mac Torrent Download-Server?

Post by ryanv »

chorlya wrote:... I don't have MacPorts installed, so you don't need it either... Transmission 1.72 doesn't build for me on Leopard
if you download and install mac ports and use the transmission-x11 package, transmission 1.72 will compile.
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Headless Mac Torrent Download-Server?

Post by bulljit »

chorlya wrote: 2. TD will pickup .torrent files form your regular installation of Transmission.app for that user. This happens some times, other times not. I'm not sure if this should happen at all or not, but its not what I want so I wrote a small script to get around that. If somebody needs that script, I'll post it here later.
This bug still exists even in the latest version 2.20+. This post is over a year old, but if you happen to stumble upon it again, can you post your above mentioned script.

Another user reported a similar bug: https://trac.transmissionbt.com/ticket/2363

Thanks
chorlya
Posts: 11
Joined: Fri Jan 16, 2009 12:16 pm

Re: Headless Mac Torrent Download-Server?

Post by chorlya »

Here is the script I use to start the daemon. I have it saved in /usr/local/bin/std (std => Start Transmission Daemon).

Code: Select all

#!/bin/bash

# Starts transmission-daemon, but first renames AppSupport/Transmission folder
# so that td doesn't pickup its settings, and copies blocklist.bin from Transmission.app

TR_DIR="/Users/$USER/Library/Application Support/Transmission"
TR2_DIR="${TR_DIR}-2"


# Rename Transmission dir
mv "$TR_DIR" "$TR2_DIR"

# Copy parsed blocklist file from Transmission.app
cp "${TR2_DIR}/blocklists/blocklist.bin" "/Users/$USER/Library/Application Support/transmission-daemon/blocklists/blocklist.bin" 

# Start the daemon
/usr/local/bin/transmission-daemon

# Give it 5 seconds to load .torrent files, just to be safe
sleep 5

# Restore the Transmission dir
mv "$TR2_DIR" "$TR_DIR"
And here is the one I use to stop the daemon. I have it saved in /usr/local/bin/qtd (qtd => Quit Transmission Daemon).

Code: Select all

#!/bin/bash

PID_FILE="/td/td.pid"
if [ -f "$PID_FILE" ]; then
	PID="`cat $PID_FILE`"
else
	echo "PID file does not exist! Can't kill transmission-daemon."
	exit
fi

if [ -n "$PID" ]; then
        kill $PID
fi

echo -n "Waiting for the daemon to exit "
sleep 2

COUNT=1
while [ -f "$PID_FILE" ]; do
        COUNT=$((COUNT + 1))
        if [ $COUNT -gt 60 ]; then
                echo -n "transmission-daemon doesn't respond, killing it with -9"
                kill -9 "$PID"
                break
        fi

        sleep 2
        echo -n "."
done

echo " done"
This qtd script depends on having PID file enabled in daemon's settings.json file.

If you just want to copy these scripts verbatim, then make sure you have

Code: Select all

"pidfile": "/td/td.pid"
in your settings.json somewhere and that /td directory exists and is world readable and writable. I have it set to 0777.
If you want to save PID file somewhere else, make sure you use same path in settings.json and for PID_FILE variable in qtd script.

Let us know weather or not this works for you as well as it does for me.
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Headless Mac Torrent Download-Server?

Post by bulljit »

Very clever workaround, chorlya. It works as advertised.

Unfortunately knowing that I have to trick the daemon, is driving me nuts. I think I'm very close to a fix. Stay tuned...
bulljit
Posts: 17
Joined: Mon Jan 24, 2011 4:31 pm

Re: Headless Mac Torrent Download-Server?

Post by bulljit »

OK I got it!

*WARNING: I'm in the medical field and have NO formal programming background, just what I read google. This will likely cause your computer to explode*

The file that needs to be modified is ../libtransmission/platform.c

The original file beginning at line 281 reads:

Code: Select all

#ifdef SYS_DARWIN
        path = tr_buildPath( getHomeDir( ), "Library",
                              "Application Support",
                              "Transmission", NULL );
Change it to this instead:

Code: Select all

#ifdef SYS_DARWIN
        const char * appname;
		path = tr_buildPath( getHomeDir( ), "Library",
                              "Application Support",
                              appname, NULL );
Now build transmission-daemon with xcode. This version should leave your Transmission.app torrents alone :D

The key is changing "Transmission" to appname and then defining the variable (I guessed at the syntax). Let me know if this works for you too!
Post Reply