Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # For information on options, see the transmission-daemon(1) man page.
- #
- # The commented variables in this file are the defaults that are used
- # in the init-script. You don't need to uncomment them except to
- # customize them to different values.
- #
- # ----- MAIN CONFIGURATION -----
- #
- # The folder where Transmission stores its config and .torrent files
- # TR_HOME=/var/transmission/config
- # The folder where Transmission stores downloads
- # TR_DOWNLOAD=/var/transmission/downloads
- # The port Transmission uses to connect to other peers
- # TR_PORT=54318
- # The name of the user that runs transmission-daemon and owns the files
- # TR_USERNAME=nobody
- # Login credentials for the Web- and the RPC-interface
- # - default: leave commented/empty to disable access authentication
- # REMOTE_USER=""
- # REMOTE_PASS=""
- # - alternative: set a user name and password
- # REMOTE_USER=admin
- # REMOTE_PASS=password
- #
- # ----- ADVANCED OPTIONS -----
- #
- # Acces control lists
- # (machines/networks allowed/denied to control transmission -- comma separated)
- # TR_ACL="+127.0.0.1"
- # or (for versions 1.4x -- different syntax)
- # TR_ACL="127.0.0.1"
- # Enable use of block lists
- # (read the Wiki about what else needs to be done)
- # TR_BLOCK=no
- # Control port used
- # only privileged users can use ports < 1024, this applies to TR_USERNAME
- # CTL_PORT=9091
- # Initial speed limits (in K/s)
- # default: no limits? 100/100 seems to be the hardcoded default
- # TR_UP_SPEED=unlimited
- # TR_DN_SPEED=unlimited
- # Peer exchange
- # TR_PX=no
- # Port mapping using NAT/UPnP
- # TR_PMAP=no
- # Encryption
- # Any of :
- # TR_ENCRYPT=tolerated
- # TR_ENCRYPT=prefered
- # TR_ENCRYPT=required
- # Overall peer limit.
- # TR_PEERS=240
- # Peer limit per torrent.
- # TR_PPT=60
- You can add extra dependencies to transmission by adding some variables to this file, for instance:
- RC_NEED="nfs"
- You'll have to create the directories used, if they don't exist (this is something the Gentoo installation should have done, but since it installs for transmission running as root, its not). Adjust paths as necessary to be the same as your configuration.
- mkdir -p /var/transmission/config
- mkdir -p /var/transmission/downloads
- chown -R nobody:nogroup /var/transmission
- And the startup script, which uses automagically the options file:
- /etc/init.d/transmission
- #!/sbin/runscript
- #
- # DO NOT EDIT!
- # ------------
- # All configurable options are set in /etc/conf.d/transmission
- declare -a OPTIONS
- OPTIONS+=" -a ${TR_ACL:=127.0.0.1}"
- if [ -z "$TR_BLOCK" -o "$TR_BLOCK" = "no" ]; then
- OPTIONS+=" -B"
- else
- OPTIONS+=" -b"
- fi
- OPTIONS+=" -g ${TR_HOME:-/var/transmission/config}"
- OPTIONS+=" -l ${TR_PPT:-60}"
- OPTIONS+=" -L ${TR_PEERS:-240}"
- OPTIONS+=" -p ${CTL_PORT:-9091}"
- if [ -z "$REMOTE_USER" -o -z "$REMOTE_PASS" ]; then
- OPTIONS+=" -T"
- else
- OPTIONS+=" -t"
- OPTIONS+=" -u $REMOTE_USER"
- OPTIONS+=" -v $REMOTE_PASS"
- fi
- OPTIONS+=" -w ${TR_DOWNLOAD:-/var/transmission/downloads}"
- declare -a EXTRA_OPT
- if [ -z "$TR_UP_SPEED" -o "$TR_UP_SPEED" = "unlimited" ]; then
- EXTRA_OPT+=" -U"
- else
- EXTRA_OPT+=" -u $TR_UP_SPEED"
- fi
- if [ -z "$TR_DN_SPEED" -o "$TR_DN_SPEED" = "unlimited" ]; then
- EXTRA_OPT+=" -D"
- else
- EXTRA_OPT+=" -d $TR_DN_SPEED"
- fi
- if [ -z "$TR_PX" -o "$TR_PX" = "no" ]; then
- EXTRA_OPT+=" -X"
- else
- EXTRA_OPT+=" -x"
- fi
- if [ -z "$TR_PMAP" -o "$TR_PMAP" = "no" ]; then
- EXTRA_OPT+=" -M"
- else
- EXTRA_OPT+=" -m"
- fi
- if [ -z "$TR_ENCRYPT" -o "$TR_ENCRYPT" = "tolerated" ]; then
- EXTRA_OPT+=" -et"
- elif [ "$TR_ENCRYPT" = "prefered" ]; then
- EXTRA_OPT+=" -ep"
- elif [ "$TR_ENCRYPT" = "required" ]; then
- EXTRA_OPT+=" -er"
- else
- EXTRA_OPT+=" -et"
- fi
- E_MSG="ERROR starting transmission, check configuration."
- depend() {
- need net
- }
- start() {
- ebegin "Starting transmission daemon"
- start-stop-daemon --start --quiet \
- --chuid ${TR_USERNAME:-nobody} \
- --exec /usr/bin/transmission-daemon -- ${OPTIONS[@]} \
- || { eerror $E_MSG; eend 1; return 1; }
- sleep 2
- transmission-remote ${CTL_PORT:-9091} \
- ${REMOTE_PASS:+-n $REMOTE_USER:$REMOTE_PASS} \
- --port ${TR_PORT:-54318} ${EXTRA_OPT[@]} > /dev/null
- eend $?
- }
- stop() {
- ebegin "Stopping transmission daemon"
- start-stop-daemon --stop --quiet --retry=TERM/45/KILL/15 \
- --exec /usr/bin/transmission-daemon
- eend $?
- }
- # vim: set ft=gentoo-init-d ts=3 sw=3 et:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement