View previous topic :: View next topic |
Author |
Message |
madMAx43v3r n00b
Joined: 03 Nov 2006 Posts: 13
|
Posted: Mon Jul 23, 2007 11:54 am Post subject: HOWTO daemonize Azureus (dirty hack) |
|
|
hi @ll
i've found a good method to daemonize azureus AND to kill him properly.
All you need is this in your gentoo.config:
Code: |
# User Interface options:
# console - console based
# swt - swt (GUI) based
UI="console"
# Options you want to pass to the java binary
JAVA_OPTIONS="\$(echo $$ > ~/.azureus/azureus_daemon.pid)" # fit the pidfile location to your needs
|
and here comes the hack:
the content of $JAVA_OPTIONS is carried through all the scripts like /usr/bin/azureus and /usr/share/java-config-2/launcher/launcher.bash
until it ends in the eval command (that's evil huh?) at the end of launcher.bash
thats's it, now you have the pid of the java process in order to kill him later.
to make life easier use this init script:
Code: |
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
opts="start stop restart"
USER="p2p"
depend() {
need net
}
start() {
ebegin "Starting Azureus in daemon mode"
(start-stop-daemon --start -c "${USER}" -g "users" -N 19 -x /usr/bin/azureus_daemon -- "${USER}") &> /var/log/azureus_daemon.log &
eend $?
}
stop() {
AZ_PID=$(cat /home/${USER}/.azureus/azureus_daemon.pid)
ebegin "Stopping Azureus at pid $AZ_PID"
start-stop-daemon --oknodo --stop -p "/home/${USER}/.azureus/azureus_daemon.pid"
eend $?
}
restart() {
svc_stop
svc_start
}
|
EDIT: to run him as user $USER you need this script, too: /usr/bin/azureus_daemon
Code: |
#!/bin/bash
HOME="/home/$1"
USER="$1"
/usr/bin/azureus &
|
after starting him in daemon mode you can access him through http://azureus.sourceforge.net/plugin_details.php?plugin=webui or http://www.azureuswiki.com/index.php/AzSMRC for example |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun Aug 05, 2007 6:31 am Post subject: |
|
|
This is really nice, thanks! I might even get round to installing Azureus now Dunno, haven't tried KTorrent either, any experience?
I linked to this from my fave tips, as it's a great example of an initscript (which people are always asking about in IRC..)
Ta |
|
Back to top |
|
|
Uncle CM n00b
Joined: 13 Apr 2008 Posts: 13 Location: Bonn
|
Posted: Sun Apr 13, 2008 4:43 pm Post subject: |
|
|
Hi,
i tried this, but if i start azureus it breaks with this error:
Quote: | using /home/azureus/.azureus/gentoo.config
Exception in thread "main" java.lang.NoClassDefFoundError: $(echo
Caused by: java.lang.ClassNotFoundException: $(echo
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) |
But when i delete the line with the "JAVA_OPTIONS=" in gentoo.config it starts normal ... Do i have to change something in my configs?
I used this HowTo: http://gentoo-wiki.com/Azureus#Install_Azureus (with different directorys)
EDIT: found the solution, theres a fault. The JAVA_OPTIONS has to be:
Quote: | JAVA_OPTIONS="$(echo $$ > ~/.azureus/azureus_daemon.pid)" |
https://forums.gentoo.org/viewtopic-t-656888-start-0-postdays-0-postorder-asc-highlight-.html |
|
Back to top |
|
|
Eckos Apprentice
Joined: 25 Jan 2008 Posts: 197 Location: Houston, Texas, USA
|
Posted: Fri Apr 18, 2008 6:44 pm Post subject: |
|
|
steveL wrote: | This is really nice, thanks! I might even get round to installing Azureus now Dunno, haven't tried KTorrent either, any experience?
I linked to this from my fave tips, as it's a great example of an initscript (which people are always asking about in IRC..)
Ta |
I love KTorrent. If you ever used windows. It's just close to uTorrent. And that was my favourite. Azureus is great but a real RAM hog no matter how you throw the dice. _________________ AMD Athlon 64 X2 3800+ | 2GB DDR2 533MHz RAM | GCC-4.3.2 | Gentoo x86_64 | KDE 4.1.2 |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|