Archived

This topic is now archived and is closed to further replies.

alanwww1

Starting utorrent-server automatically as a daemon with upstart

Recommended Posts

I figured out a way to start utorrent in boot-time or manually start stopping it running as daemon.

You need an upstart equiped linux diistro (like Ubuntu karmic, lucid ...)

Here is what i did:

Let assume you have a username: "yourusername"

Copy the extracted files into ./home/yourusername/.utorrent

Create an upstart script config:

sudo nano /etc/init/utorrent.conf

Insert:

--------------------


description "utorrent startup script"
author "Alanw"

start on (local-filesystems and started dbus and stopped udevtrigger)
stop on runlevel [016]

script
cd /home/yourusername/.utorrent
exec su yourusername -c "/home/yourusername/.utorrent/utserver"
end script

--------------------

Last step is to finalize the upstart script:

sudo ln -s /lib/init/upstart-job /etc/init.d/utorrent

From this moment you can run utorrent-server as a daemon by

sudo start utorrent

or stop it with

sudo stop utorrent

And with next reboot you will have it automatocly started.

I hope it will work for everyone.

Cheers, Alan

Share this post


Link to post
Share on other sites

im a bit of a noob here

any assistance would be gr8

running ubuntu 10.04

i created the folder .utorrent in my home directory and then created and saved the script

when i try to finalize the script ¨ sudo ln -s /lib/init/upstart - job /etc/init.d/utorrent¨ this is what happens

ln: target `/etc/init.d/utorrent' is not a directory

Share this post


Link to post
Share on other sites
im a bit of a noob here

any assistance would be gr8

running ubuntu 10.04

i created the folder .utorrent in my home directory and then created and saved the script

when i try to finalize the script ¨ sudo ln -s /lib/init/upstart - job /etc/init.d/utorrent¨ this is what happens

ln: target `/etc/init.d/utorrent' is not a directory

Same problem.

Share this post


Link to post
Share on other sites

This works well at starting up utorrent server, but I find that when it's started using upstart, no changes made in the preference pane remain in effect after a restart. If you manually start utserver and change preference, they persist, but any changes made on an upstarted utserver aren't persistant.

Anyone else have this problem?

Share this post


Link to post
Share on other sites
....

Last step is to finalize the upstart script:

sudo ln -s /lib/init/upstart-job /etc/init.d/utorrent

...

I think that this step is unnecessary. This step is to connect old init system with the new (upstart) but, IMHO, it's unnecessary.

My upstart scripts don't use this link and they works well. The only difference is that I can't start/stop/... it with "/etc/init.d/script-name start/stop/..."

This works well at starting up utorrent server, but I find that when it's started using upstart, no changes made in the preference pane remain in effect after a restart. If you manually start utserver and change preference, they persist, but any changes made on an upstarted utserver aren't persistant.

Anyone else have this problem?

Are you executing utserver with the same user than in upstart script?

Share this post


Link to post
Share on other sites
This works well at starting up utorrent server, but I find that when it's started using upstart, no changes made in the preference pane remain in effect after a restart. If you manually start utserver and change preference, they persist, but any changes made on an upstarted utserver aren't persistant.

Anyone else have this problem?

I have this problem too. on ubuntu 10.10 server.

How i can fix this?

Share this post


Link to post
Share on other sites

I've been having this problem also, up until I got some time to debug it.

When upstart stops a job, it sends it the TERM signal - the default kill signal.

If job has not stopped in the default 'kill timeout' (which is 5 seconds), it then sends the KILL signal - equivalent to kill -9 (hard kill).

i.e., if within 5 seconds of TERM signal, your utserver hasn't had time to flush caches, and finally write settings.dat, all changes made in web GUI are lost - and probably some cached chunks...

My solution? Set the kill timeout on the upstart job conf to something more suitable.

Just drop the line

kill timeout #sec-to-wait

right after

stop on

I've changed to 30 seconds, and seems to be doing fine.

./bb

Share this post


Link to post
Share on other sites