You are not logged in.

#1 2008-11-08 12:04:15

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 258

Deluge daemon

Hi all

given the fact that from version 0.6 Deluge Torrent client has been divided in two parts, Gui and Daemon, i was wondering if anyone istoble of realize a daemon script for starting\restarting\stopping the daemon to place in the /etc/rc.d/ folder, like the ones for the various apps like mysql, apache, etc etc..

by now, i'm using deluge-daemonized by starting it with the /etc/inittab method, and it is stopped in a not-very-clean way by the halt command..

maybe in can be installed by default when installing the deluge arch package.. what do you think?

sorry if I made some English errors wink

Offline

#2 2008-11-08 13:02:45

string
Member
Registered: 2008-11-03
Posts: 286

Re: Deluge daemon

(Not sure why you posted this in `Multimedia and games`)

You could either write your own script or make use of /etc/rc.local and /etc/rc.local.shutdown. What exactly is this "/etc/inittab" >>method<< you speak of?

Offline

#3 2008-11-09 02:47:34

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: Deluge daemon

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case "$1" in
    start)
        stat_busy "Starting deluged"
        su -c '/usr/bin/deluged --config /home/peets/.config/deluge' peets
        add_daemon deluged
        stat_done
    ;;
    stop)
        stat_busy "Stopping deluged"
        /usr/bin/killall deluged
        if [ $? -gt 0 ]; then
            stat_fail
        else
            rm_daemon deluged
            stat_done
        fi
    ;;
    *)
        echo "usage: $0 {start|stop}"
esac
exit 0

The main problem with this is that you have to pick a specific user as whom deluged will run. If another user connects to the daemon, they can spawn any file they want in the daemon user's download directory, even if they don't have write permissions on that directory. Maybe making a 'deluge' user and letting everyone read from the download directory will work if every user is well-behaved; nothing is there to stop anyone from cancelling someone else's torrents. If there are multiple users on the system, it's best that they each run their own deluge daemon.

If you're the only user on your machine, this might be useful though wink

Maybe one day deluge will have it's own user/permission management.

Offline

#4 2008-11-09 07:01:09

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 258

Re: Deluge daemon

string wrote:

(Not sure why you posted this in `Multimedia and games`)

You could either write your own script or make use of /etc/rc.local and /etc/rc.local.shutdown. What exactly is this "/etc/inittab" >>method<< you speak of?

i added  this some time ago to my /etc/inittab

# run deluged (on port 58846) with logging to /var/log/deluged.log
dd:3:respawn:su - berseker -c "/usr/bin/deluged -d -p 58846 &> /var/log/deluge/deluged.log"
# run deluge webui with logging to /var/log/deluge-webui.log
dw:3:respawn:su - berseker -c "/usr/bin/deluge -u web &> /var/log/deluge/deluge-webui.log"

@peets
thank you, I will try this as soon as possible!

Offline

#5 2008-11-10 06:47:53

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 258

Re: Deluge daemon

i've tried your script and it works, but it has a problem..

i've placed it in my daemons list in rc.conf, and when the system starts, the daemon is effectively running (i can access to it remotely, and i can access to the system too, by ssh remote connection) but the initial list of daemons [done] [done] [done] etc. hangs on "deluged [busy]"...

i've to admit that i slightly modified the script,adapting it to my situation, maybe i've done some errors btw..

case "$1" in
    start)
        stat_busy "Starting deluged"
        su - berseker -c '/usr/bin/deluged -d --config /home/berseker/.config/deluge' &> /var/log/deluge/deluged.log
        add_daemon deluged
        stat_done
    ;;
    stop)

Offline

#6 2008-11-10 08:16:47

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Deluge daemon

http://bugs.archlinux.org/ post a Feature Request and link to this thread.

For the user the daemon runs at, it might be useful to create an /etc/conf.d/deluge to specify it and not have it hardcoded.

Offline

#7 2008-11-10 11:50:24

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 258

Re: Deluge daemon

ok lphitus.. thank you

http://bugs.archlinux.org/task/12071

Last edited by Berseker (2008-11-10 12:02:22)

Offline

#8 2008-12-02 13:16:29

vexxor
Member
Registered: 2008-07-17
Posts: 45

Re: Deluge daemon

i use the following script

[vexxor@raketa ~]$ cat /etc/rc.d/deldae
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

PID=`pgrep deluged`
case "$1" in
  start)
    stat_busy "Starting Deluge Daemon"
    su surfer -c "/usr/bin/deluged --config=/home/.deluge/conf --logfile=/home/.deluge/logs/log"
    if [ $? -gt 0 ]; then
      stat_fail
    else
      echo $(pgrep deluged) > /var/run/deldae.pid
      add_daemon deldae
      stat_done
    fi
    ;;
  stop)
    stat_busy "Stopping Deluge Daemon"
    kill $PID &> /dev/null
    if [ $? -gt 0 ]; then
      stat_fail
    else
      rm /var/run/deldae.pid
      rm_daemon deldae
      stat_done
    fi
    ;;
  restart)
    $0 stop
    sleep 1
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"
esac
exit 0

Seems to work OK, never had problems with it. Me and my wife both use the computer, so there is one disk for movies, multimedia, etc to which we have unlimited shared access. The account "surfer" is there for guests to use, and I chose that user to run the daemon, rather than make a new "deluge" user. I guess that would be even better, but i couldn't be bothered at the time. Deluge is setup to download to a "working torrents" folder, and upon completion transfer the file to a "completed torrents folder". This is the default behaviour, and can be altered per-torrent. I couldn't find a nice way to "kill" deluge, it doesn't seem to have a switch to shutdown. Although i haven't noticed problems with the "kill" approach, if anyone's found something, post it please.

Offline

#9 2008-12-02 14:41:32

keerthi
Member
Registered: 2007-11-18
Posts: 95

Re: Deluge daemon

Offline

Board footer

Powered by FluxBB