launchd

Feature requests for the Mac OS X version of Transmission
Post Reply
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

launchd

Post by Pierobon »

Hey,
I'm a very basic computer user, I have a headless mac mini here serving some files and with a TeamSpeak server running on it.

What I would like to ask you guys is a zipped download on the downloads page that has already the built package to run transmission without a GUI (via terminal window for example), but without the need to install Apple X-Code and all those crazy pro stuff.
I am using the teamspeak3 server example because I already used it, it was VERY easy to set up once the steps were discovered, and it runs even before the login window opens on the mac osx.
To open TS3 server in the regular way (mac linux or even windows) you need to type 2 commands on any terminal window.
If you want it to run as daemon on the mac, you have to put an extra ini file on the app folder, an extra plist on the /Library/LaunchDaemons/ folder, and reboot... and that is pretty much it.

I would like transmission to be as easy as that to set up on any mac as a daemon, this is my request.

and than access it remotely via browser, this already exists... =)
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

Problem is, I don't know what elements must be written in this specific plist file.

I tried this according to OSX dev website (didn't work):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
		<string>local.transmission</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Applications/Transmission.app</string>
	</array>
	<key>KeepAlive</key>
	<true/>
</dict>
</plist>
I think something is missing so the regular app can be run without doubleclick action to open.

Also, I didnt add it to the login items in the pref pane, because in that case I would need to type a user and password to log in to the computer before the program can be run.
What I really want is for the daemon to be executed before the login, as a system process.

[EDIT]
Have no idea what you mean by command-B, I typed in the command u suggested "svn://svn.transmissionbt.com/Transmission/trunk", all I got was a "No such file or dir" answer.
Also, safari can't find the address... :lol:

So, that's it for now, awaiting more tips. =)
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

Well, that's precisely what I am requesting in this topic:
A build of Transmission that can be launched via OSX launchd, without the need to install Xcode.

And it's not the app that would require login.
What I meant is that anything added to the "pref-pane login items" would require that specific user logging in prior to the auto-launch.
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

Ok guys,

I have just managed to create a working plist file.
The problem is that it only launches the transmission app after ANY user logs in, what pretty much defeats the propose of making an automated script. What it looks like is that the system loads everything right away, but transmission waits for something to open before start running 100%.
What I want is for it to run before someone write down the OS login and password...

Can someone please take a better look at this?
I mean, I know that there is already a way to configure a headless way to run transmission.
I am just asking for a very simpler way to do it without downloading apple SDK and xcode and having to do so many procedures...
Ah, and by the way, I have already managed to run other stuff (e.g. teamspeak3server) with this very same procedure I describe here, so I know it must be very easy to write the codes to do this with transmission! :mrgreen:

What I did to get to the point I am now:
- Download Transmission.app to /Applications/ folder.
- Save following plist file as /Library/LaunchDaemos/transmission.plist
- Do terminal command: sudo chown root /Library/Launchdaemons/transmission.plist
- Reboot machine.

If you don't want to reboot, you can also start this daemon just by doing terminal command: launchctl load /Library/Launchdaemons/transmission.plist (or stop it by changing command to unload, but it will load again on next reboot.)

My plist file, hand-made in TextEdit.app (rich text format must be converted to plain text):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
		<string>local.transmission</string>
	<key>UserName</key>
		<string>server</string>
	<key>Program</key>
		<string>/Applications/Transmission.app/Contents/MacOS/Transmission</string>
	<key>KeepAlive</key>
		<true/>
</dict>
</plist>
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

Once everything is set-up and running, all one have to do is add this code to the plist, and you have transmission running with whatever user you write down inside the following string.

Code: Select all

<key>UserName</key>
<string>user</string>
Only the plist file must be owned by root for the system to start the daemon on this folder.

If you want a daemon for just a single user, the the plist file must be owned by that specific user or some admin, and it must be saved instead into ~/Library/LaunchDaemons/
In this case, the daemon will only run once that specific user logs into the computer (type in user and pass into OS login window).
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

Ok, I give up!
I downloaded Xcode, built it, tried to plist a daemon, but I had just exactly the same result.
I think I am trying to start the usual app instead of the daemon scripts.
x190 wrote:Re plist: Don't you need to start transmission-daemon (Xcode again) not the .app? The app would require login? Sorry, I'm not up on the finer points of launchd plists. Search or try to copy an existing one.
Can someone please teach me how to run the daemon scripts instead of the app?
Sorry for such ignorance! :roll:
Pierobon
Posts: 16
Joined: Fri Oct 19, 2012 8:17 pm

Re: launchd

Post by Pierobon »

x190 wrote:Start-up scripts are discussed in Transmission's wiki.
I was looking precisely for them, already tried the wiki, I found the scripts page but I really don't understand a thing about what's there.
That's why I asked if someone could teach me the procedures to launch the transmission daemon.

:arrow: Anyone?
Post Reply