init.d script for openSUSE

General support for problems installing or using Deluge
ZingerWot

Re: init.d script for openSUSE

Post by ZingerWot »

I removed the -P from the arguments and then things started to work for me.

I too added the -c, but it think it may not be needed if you changed to "/home/$DELUGED_USER" before running any binary.
I think that is why i got the /root/.config permission error.

Many thanks for getting me started. Now that i have the daemon running, i see that the webui controls now work.

Zw
samuel337
New User
New User
Posts: 3
Joined: Sat Oct 23, 2010 7:28 am

Re: init.d script for openSUSE

Post by samuel337 »

I've updated the script on the wiki (http://dev.deluge-torrent.org/wiki/User ... t/OpenSUSE) to fix a few bugs. The primary one is that the plugins should now work because I have redirected the PYTHON_EGG_CACHE to somewhere writable by the deluge user (otherwise, there would be errors when loading plugins as Python would not be able to extract the eggs).

I've also changed the logging functionality so it logs to the standard location, /var/logs.
monkeyslut
New User
New User
Posts: 2
Joined: Mon Aug 25, 2014 12:00 pm

Re: init.d script for openSUSE

Post by monkeyslut »

I'd like to send my most sincere thanks for these posts. Firstly, because it helped me solve my problem. Secondly, and probably most importantly, because that bottle of brugal made it the most entertaining tech post I've ever read.
I move to propose all Linux Wizards drink before they post.

All the love
Mudlove, Malmö
jferrandis wrote:Hi johnnyg,

Well I was juggling with my pride, when I saw my keyboard going from my hands to my navel and saw my apartment colleegue running to the street, and I said: move over busker, that's not my style, your time is coming in a little while, but mine is coming to realize my dreams. My sofa hit me to the left, hit me to the right, and I knew what you feel when an earthquake is hitting your ass. I needed only 20 seconds to finish my post and then I`ll try between step down stairs or throw me through the window (I'm in a second floor). But, another outage let my screen fading to black. One brugal bottle later, I can answer you.

I've changed the pidfile to point to /.config/deluge cause deluged daemon started as user can't write at system path. And I think I can't edit the wiki because another guy wrote it and I have not root privileges (hahaha).

But, I'm here and not seeking for a Cathedral, you know? Reading 'man deluged' I've discovered -c option, and used it. Solved file permissions. The new script let u use console and Runevels, and write at logfile if there is a problem:

Code: Select all

#! /bin/sh
# Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany.
#
# Author: José Ferrandis
#
# /etc/init.d/deluged
#
#   and symbolic its link
#
# /usr/sbin/deluged
#
### BEGIN INIT INFO
# Provides: deluged
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network

# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Daemonized version of deluge.
# Description:       Starts the deluge daemon with the user deluged

### END INIT INFO

DELUGED_BIN=/usr/bin/deluged

test -x $DELUGED_BIN || exit 5

DELUGED_USER="deluge" 
test -n "$DELUGED_USER" || exit 6

DELUGED_ARGS="-P /.config/deluge/deluged.pid -c /.config/deluge/ -l /.config/deluge/deluged.log" # consult man deluged for more options

. /etc/rc.status

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

# First reset status of this service
rc_reset

case "$1" in
    start)
        
	echo -n "Starting DELUGE daemon"
	## Start daemon with startproc(8). If this fails
	## the echo return value is set appropriate.

	startproc -f -u $DELUGED_USER $DELUGED_BIN $DELUGED_ARGS

	# Remember status and be verbose
	rc_status -v
	;;
    stop)
	echo -n "Shutting down DELUGE daemon"
	## Stop daemon with killproc(8) and if this fails
	## set echo the echo return value.

	killproc -TERM $DELUGED_BIN

	# Remember status and be verbose
	rc_status -v
	;;
    try-restart)
        ## Stop the service and if this succeeds (i.e. the 
        ## service was running before), start it again.
        $0 status >/dev/null &&  $0 restart

        # Remember status and be quiet
        rc_status
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
    force-reload|reload)
	## Signal the daemon to reload its config. Most daemons
	## do this on signal 1 (SIGHUP).

	echo -n "Reload service DELUGED"

	killproc -HUP $DELUGED_BIN

        rc_status -v

        ;;
    status)
	echo -n "Checking for service DELUGED "
        ## Check status with checkproc(8), if process is running
        ## checkproc will return with exit status 0.

        # Status has a slightly different for the status command:
        # 0 - service running
        # 1 - service dead, but /var/run/  pid  file exists
        # 2 - service dead, but /var/lock/ lock file exists
        # 3 - service not running

	checkproc $DELUGED_BIN

	rc_status -v
	;;
    probe)
	## Optional: Probe for the necessity of a reload,
	## give out the argument which is required for a reload.

	;;
    *)
	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
	exit 1
	;;
esac
rc_exit
And I think all is done. Don't you? Find a Cathedral and tell me why.
Post Reply