This is the old SliTaz forum - Please use the main forum.slitaz.org

script transmission
  • JaviJavi September 2010
    Hello friends, I've ridden it a download server with an old pc (download legal things clear, and I have in / etc / init.d / a bash "transmission.sh" which contains the following

    #! / Bin / sh

    echo "running transmission ..."

    transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01

    Well, when I start the pc, I see that you run the bash, but something I'm doing wrong, because the initial, I skip the aid of transmission-daemon, as if not swallow the variables, if you copy it and stick it in a terminal and execute it on my own it works, I have something wrong, something has to be quoted or something.

    Sorry for my bad english

    Greetings
  • Trixar_zaTrixar_za September 2010
    Does the script start with #!/Bin/sh or #!/bin/sh ? If it's Bin and not bin, the it won't work at all. Also you need to set the script to executable with chmod +x transmission.sh

    This unimportant though, you could probably just add the transmission-daemon line to your local.sh in Menu-->System Tools--->Control Box--->Initialization and click the button next to "Add local commands" and add in transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01 in there.
  • JaviJavi September 2010
    Hello Trixar_za

    PD: sorry for my bad english

    Thanks for the help, start bash with #!/bin/sh and has execute permissions.

    I set it in local.sh Escript, but dont work, if I put a script "prueba.sh" "in local.sh" : echo "hello"> /root/Hello.txt, it works, but the script transmission.sh does not work.

    If I run "transmission.sh" manually from console "sh transmission.sh" does not work, show the help of transmission, but if I copy / paste the content in the console, if it works

    I do not know what to do

    Regards
  • Trixar_zaTrixar_za September 2010
    Have you tried adding just:
    transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01
    to the local.sh file? That way it does the same as what transmission.sh file would do, only it runs the command in local.sh instead.

    Here is how my local.sh looks to give you the idea:
    #!/bin/sh
    # /etc/init.d/local.sh - Local startup commands.
    #
    # All commands here will be executed at boot time.
    #
    . /etc/init.d/rc.functions

    echo "Starting local startup commands... "
    echo '1d09 4000' > /sys/bus/usb-serial/drivers/option1/new_id
    echo "Starting vnstat deamon..."
    vnstatd -d
  • JaviJavi September 2010
    Hello Trixar_za

    Thansk for the help

    I have put the line into local.sh

    #!/bin/sh
    # /etc/init.d/local.sh - Local startup commands.
    #
    # All commands here will be executed at boot time.
    #
    . /etc/init.d/rc.functions

    transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01

    echo "test" > /media/hdd01/test.txt







    But dont work, the file test.txt was found and work, but transmission dont start, if I copy and paste "transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01" into a console it work for me.


    I do not know what to do

    Regards
  • babaorumbabaorum September 2010
    Hi,
    Here are some complementary questions for you, maybe it will help (or not :P ) :

    1 ) have you installed the transmission-daemon package besides of the general transmission package ?

    2 ) what is the returned code of transmission-daemon from the command line, as current user and as root user ?

    3) what is the error code returned w/ same command ?
    echo $? displays the error code of the last executed command in shell

    Regards,
    --Babaorum
  • JaviJavi September 2010
    hello babaorum, thanks for the help me

    1) yes i have installed transmission-daemon and transmission package

    2) Nothink is returned when i type "transmission-daemon"

    root@slitaz:/home/tux$ transmission-daemon
    root@slitaz:/home/tux$

    Top display transmission daemon of running correctly

    3) returned: 0

    If I type in command line

    transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01

    Work for me, but If I put into de transmission.sh or local.sh this:

    transmission-daemon -p 9091 -a * -t -u hello -v hello -w /media/hdd01
    echo "test" > /media/hdd01/test.txt




    Dont work, the file test.txt was found and work, but transmission dont start, returned display of screen of help the transmission-daemon

    Regards
  • Trixar_zaTrixar_za September 2010
    Ok, I guess you need to start it as a proper daemon then. It's a little tricky to configure, but bare with me.

    First go to terminal and su to root then then type leafpad /etc/daemons.conf
    Then create these lines at the bottom of that file and save:
    # Transmission daemon options:
    TRANSMISSION_OPTIONS="-p 9091 -a * -t -u hello -v hello -w /media/hdd01"

    Ok, now create a file called transmission-daemon and add this into it:
    #!/bin/sh
    # /etc/init.d/transmission-daemon : Start, stop and restart the tranmission
    # daemon on at boot time or with the command line.
    #
    # To start the tranmission daemon at boot time, just put transmission-daemon
    # in the $RUN_DAEMONS variable of /etc/rcS.conf and configure options with
    # /etc/daemons.conf
    #
    . /etc/init.d/rc.functions
    . /etc/daemons.conf

    NAME=transmission-daemon
    DESC="File Sharing Daemon"
    # I'm assuming it's here, it might be at /usr/bin/transmission-daemon
    DAEMON=/usr/sbin/transmission-daemon
    OPTIONS=$TRANSMISSION_OPTIONS
    PIDFILE=/var/run/transmission-daemon.pid

    case "$1" in
    start)
    if active_pidfile $PIDFILE transmission-daemon ; then
    echo "$NAME already running."
    exit 1
    fi
    echo -n "Starting $DESC: $NAME... "
    $DAEMON $OPTIONS
    status
    ;;
    stop)
    if ! active_pidfile $PIDFILE transmission-daemon ; then
    echo "$NAME is not running."
    exit 1
    fi
    echo -n "Stopping $DESC: $NAME... "
    kill `cat $PIDFILE`
    status
    ;;
    restart)
    if ! active_pidfile $PIDFILE transmission-daemon ; then
    echo "$NAME is not running."
    exit 1
    fi
    echo -n "Restarting $DESC: $NAME... "
    kill `cat $PIDFILE`
    sleep 2
    $DAEMON $OPTIONS
    status
    ;;
    *)
    echo ""
    echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
    echo ""
    exit 1
    ;;
    esac

    exit 0

    Now do chmod 777 transmission-daemon and chmod +x transmission-daemon (Just make it runable and that all users can use it)

    Now in terminal, su to root again and type mv transmission-daemon /etc/init.d/

    Now go to Menu--->System Tools--->Control Box--->Initialization and add transmission-daemon just before slim in the Run daemons box so it looks like this:
    dbus hald firewall transmission-daemon slim

    Now again from terminal test if it's working by typing /etc/init.d/transmission-daemon start

    If all goes well, this should work and allow the daemon to start when you boot your PC. I haven't tested this, so it's mostly guess work, but I hope it helps.
  • JaviJavi September 2010
    Thank for your interest. I am very grateful

    When I start the daemon "/etc/init.d/transmission-daemon start"

    Returned by display the help of transmission-daemon
  • JaviJavi September 2010
    I found the solution

    If I run in console

    transmission-daemon -a * -p 9091 -t -u hola -v hola -w /media/hdd01

    Works fine for me, but If I have put into a bash script dont work, the solution if anyone has got, is quote "*" :

    transmission-daemon -a "*" -p 9091 -t -u hola -v hola -w /media/hdd01

    Thanks for all for the assistance.

    Regards
  • FusionFusion September 2010
    Thanks a lot both Javi and Trixar_za for your kind discussion.I was greatly served by your solutions.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

SliTaz Social