Howto: testing 0.6 using deluged + webui (headless *nix)

General support for problems installing or using Deluge
johnnyg
Top Bloke
Top Bloke
Posts: 1522
Joined: Sun Oct 28, 2007 4:00 am
Location: Sydney, Australia

Re: Howto: testing 0.6 using deluged + webui (headless *nix)

Post by johnnyg »

phantom wrote:
johnnyg wrote: I'd recommend using start-stop-daemon, it allows you to run programs as different users (i.e. not root) as well as having an option to force the program to run in the background.
It is my understanding that start-stop-daemon is not available in Fedora. If it is, I am unsure where it is located or how to install it. Thoughts?

Code: Select all

/etc/init.d/deluged: line 13: start-stop-daemon: command not found
ah my bad, have you tried "man daemon"?
phantom
New User
New User
Posts: 4
Joined: Sat Dec 06, 2008 9:14 am

Re: Howto: testing 0.6 using deluged + webui (headless *nix)

Post by phantom »

johnnyg wrote:
phantom wrote:
johnnyg wrote: I'd recommend using start-stop-daemon, it allows you to run programs as different users (i.e. not root) as well as having an option to force the program to run in the background.
It is my understanding that start-stop-daemon is not available in Fedora. If it is, I am unsure where it is located or how to install it. Thoughts?

Code: Select all

/etc/init.d/deluged: line 13: start-stop-daemon: command not found
ah my bad, have you tried "man daemon"?
It turns out the daemon functionality is unfortunately limited in its abilities. I ended up mimicking some of its functionality, adding the force background myself with the following lines:

Code: Select all

runuser -s /bin/bash - deluge -c "ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1 ; deluge -u web -c /storage/fileshare/Torrents/.deluge/ -l /storage/fileshare/Torrents/.deluge/deluge-web.log &"
[ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"
This seems to work, starting both deluged and deluge -u web as the user "deluge".

Here is the entire fedora script, in case others are interested. Its not the best, but it gets the job done:

Code: Select all

#!/bin/bash
# chkconfig: 345 85 15
# description: deluged is the Deulge bit torrent daemon. It performs downloads and manages torrents. Connect to the service through the configured port.
# Script to manage start and stopping the fedora service
# processname: deluged

    # Source function library.
    . /etc/init.d/functions

    RETVAL=0;

    start() {
        echo "Starting deluged service"
        daemon --user=deluge deluged -c /storage/fileshare/Torrents/.deluge/ -p 58846 -l /storage/fileshare/Torrents/.deluge/deluged.log
        RETVAL1=$?
        echo
        [ $RETVAL1 = 0 ] && touch /var/lock/subsys/deluged
        
        echo "Starting deluge webui"
        #daemon --user=deluge deluge -u web -c /storage/fileshare/Torrents/.deluge/ -l /storage/fileshare/Torrents/.deluge/deluge-web.log
        #deluge -u web -c /storage/fileshare/Torrents/.deluge/ -q &
        #cant find force background option in daemon function, so I add my own &
        runuser -s /bin/bash - deluge -c "ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1 ; deluge -u web -c /storage/fileshare/Torrents/.deluge/ -l /storage/fileshare/Torrents/.deluge/deluge-web.log &"
        [ "$?" -eq 0 ] && success $"$base startup" || failure $"$base startup"

        RETVAL2=$?
        echo
        [ $RETVAL2 = 0 ] && touch /var/lock/subsys/deluge-web
   
        RETVAL=1
        if [ $RETVAL1 == 0 ]; then
            if [ $RETVAL2 == 0 ]; then
                RETVAL=0
            fi
        fi
        return $RETVAL
    }

    stop() {
        echo "Stopping deluge webui"
        killproc deluge
        RETVAL1=$?
        echo
        [ $RETVAL1 = 0 ] && rm -f /var/lock/subsys/deluge-web

        echo "Stopping deluged service"
        killproc deluged
        RETVAL2=$?
        echo
        [ $RETVAL2 = 0 ] && rm -f /var/lock/subsys/deluged
    }

    restart() {
        stop
        start
    }

case $1 in
    start)
        start
    ;;
    stop)
        stop
    ;;
    restart)
        restart
    ;;
    status)
        status deluged
        status deluge
        RETVAL=$?
    ;;
    *)
    echo $"Usage: $0 {start|stop|restart|status}"
    exit 1
esac

    exit $RETVAL
Post Reply