Transmission daemon upstart support

Bug #1031035 reported by Patrick Winchester
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
transmission (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I have attached an upstart script to run transmission-daemon with upstart instead of sysvinit.
This has two advantages:

1.
Upstart supports graceful shutdown timeouts. This means upstart will
wait for transmission to exit properly for an amount of time before
killing it (in this script 30 seconds) which is useful if transmission
needs to transmit a lot of status data to trackers on exiting.

2.
Upstart supports automatic respawning when transmission-daemon crashes /
exits with a non-clean exit code. This happened to me quite regularly
every couple of weeks and it's a helpful feature. With the default
setting upstart will try to restart transmission up to 10 times with 5
second intervals between the tries.

For deployment, just copy the
file into the debian directory and debhelper will take care of proper
installation, no additional work needed. On debian were there is no
upstart debhelper will just install the plain old init file, so no
trouble there either.
I tested the script on precise, it works very well for me but I'm sure additional testing will not hurt.

Please feel free to publish this under any license / copyright / author / whatever you see fit. Hope this can be useful.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in transmission (Ubuntu):
status: New → Confirmed
Revision history for this message
Marcus (m-beyer5) wrote :

+1 from me, would be nice to see this happen in 12.10.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

I see that you check if the transmission job is enabled within the the script.
Based on the upstart cookbook, it is more correct to:
* check conditions in pre-start script
* call `stop` which will prevent the current job from starting
* exit 0

See:
http://upstart.ubuntu.com/cookbook/#stop-a-job-from-running-if-its-configuration-file-has-not-been-created-modified

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Here is an example snippet:

http://upstart.ubuntu.com/cookbook/#pre-start-example-ubuntu-specific
"""
pre-start script

  # stop job from continuing if no config file found for daemon
  [ ! -f /etc/default/myapp ] && { stop; exit 0; }

  # source the config file
  . /etc/default/myapp

  # stop job from continuing if admin has not enabled service in
  # config file.
  [ -z "$ENABLED" ] && { stop; exit 0; }

end script
"""

You will need to source the config file again to get the customized options.

If you implement the pre-start correctly, I'd be happy to sponsor this into Ubuntu.

Revision history for this message
Patrick Winchester (patrick-winchester) wrote :

Hi Dmitrijs,

I have attached an updated version of the script that should now match your criteria.
Thanks for sponsoring this.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package transmission - 2.61-0ubuntu2

---------------
transmission (2.61-0ubuntu2) quantal; urgency=low

  * Add upstart job (LP: #1031035)
 -- Patrick Winchester <email address hidden> Fri, 24 Aug 2012 02:26:46 +0100

Changed in transmission (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.