Upstart job for multiple instances of deluged

Questions about applications and software
Forum rules
Before you post please read this

Upstart job for multiple instances of deluged

Postby bhp on Mon Jan 06, 2014 11:48 pm

Hi all. I'm using Deluge as my bittorent client, running in daemon/client mode so that I can access my desktop from my netbook on the road. I succesfully set up the daemon to start on boot with the upstart script found here. Now I'm trying to run a second instance of deluged (the deluge daemon) with it's own account, a seperate ui port, etc. The script I'm using is this:

Code: Select all
# deluged - Deluge daemon
#
# The daemon component of Deluge BitTorrent client. Deluge UI clients
# connect to this daemon via DelugeRPC protocol.

description "Deluge daemon"
author "Deluge Team"

start on filesystem and static-network-up
stop on runlevel [016]

respawn
respawn limit 5 30


exec start-stop-daemon -S -u "deluge" -c "deluge:deluge" -k 007 -x /usr/bin/deluged -- -p 58846
exec start-stop-daemon -S -u "deluge2" -c "deluge2:deluge2" -k 007 -x /usr/bin/deluged -- -p 58847


To be honest I don't really understand the first part of the script too well, but what I think I know is that both exec lines should be run during the boot process. The problem I'm having is that after boot, only the second process is running. This would lead me to believe that the second line is killing the already running process before starting the second. However, if I comment out the second line and then run it manually, (everything after the exec) the process starts normally with no errors and both daemons are running and contactable. Anyone know what I'm doing wrong, or where to look for more evidence of what's happening? Is there a log where errors in upstart scripts are logged? Thanks.
bhp
Level 1
Level 1
 
Posts: 2
Joined: Wed Dec 18, 2013 4:25 pm

Linux Mint is funded by ads and donations.
 

Re: Upstart job for multiple instances of deluged

Postby perham on Tue Jan 07, 2014 2:30 am

bhp wrote:Hi all. I'm using Deluge as my bittorent client, running in daemon/client mode so that I can access my desktop from my netbook on the road. I succesfully set up the daemon to start on boot with the upstart script found here. Now I'm trying to run a second instance of deluged (the deluge daemon) with it's own account, a seperate ui port, etc. The script I'm using is this:

Code: Select all
# deluged - Deluge daemon
#
# The daemon component of Deluge BitTorrent client. Deluge UI clients
# connect to this daemon via DelugeRPC protocol.

description "Deluge daemon"
author "Deluge Team"

start on filesystem and static-network-up
stop on runlevel [016]

respawn
respawn limit 5 30


exec start-stop-daemon -S -u "deluge" -c "deluge:deluge" -k 007 -x /usr/bin/deluged -- -p 58846
exec start-stop-daemon -S -u "deluge2" -c "deluge2:deluge2" -k 007 -x /usr/bin/deluged -- -p 58847


To be honest I don't really understand the first part of the script too well, but what I think I know is that both exec lines should be run during the boot process. The problem I'm having is that after boot, only the second process is running. This would lead me to believe that the second line is killing the already running process before starting the second. However, if I comment out the second line and then run it manually, (everything after the exec) the process starts normally with no errors and both daemons are running and contactable. Anyone know what I'm doing wrong, or where to look for more evidence of what's happening? Is there a log where errors in upstart scripts are logged? Thanks.


drop first exec so that it looks like this:

Code: Select all
start-stop-daemon -S -u "deluge" -c "deluge:deluge" -k 007 -x /usr/bin/deluged -- -p 58846
exec start-stop-daemon -S -u "deluge2" -c "deluge2:deluge2" -k 007 -x /usr/bin/deluged -- -p 58847


if this didn't work either, try dropping both execs

Code: Select all
start-stop-daemon -S -u "deluge" -c "deluge:deluge" -k 007 -x /usr/bin/deluged -- -p 58846
start-stop-daemon -S -u "deluge2" -c "deluge2:deluge2" -k 007 -x /usr/bin/deluged -- -p 58847


the reason is that exec replaces the shell with the command, so the shell is not running anymore to continue the script. it causes very weird problems sometimes.
AMD Phenom II X6 1090T 3.2GHz DDR3-1600 12GB ]LinuxMint 16 Cinnamon
Intel Pentium 4 540 3.2GHz DDR-400 2GB LinuxMint 16 Mate
Intel Pentium 4 1.5 GHz 512MB Debian Jessie LXDE
User avatar
perham
Level 3
Level 3
 
Posts: 118
Joined: Sat Dec 28, 2013 7:52 pm
Location: Belgium

Re: Upstart job for multiple instances of deluged

Postby bhp on Tue Jan 07, 2014 5:23 am

Thanks. I've actually managed to fix the problem just by running seperate upstart scripts for each process. I'm definitely going to be reading up on how the exec function works though, it's be nice to know in the future.
bhp
Level 1
Level 1
 
Posts: 2
Joined: Wed Dec 18, 2013 4:25 pm


Return to Software & Applications

Who is online

Users browsing this forum: Bing [Bot], Bryan88 and 14 guests