Install and configure Azureus
- Download Azureus and decompress it into a directory
- Download log4j.jar and commons-cli.jar and put them in the directory you uncompressed Azureus into
- Run Azureus by opening a terminal, changing into the directory you put Azureus and typing
- Configure Azureus with the GUI tool
- Exit Azureus
- Create a file called headless.sh with the following in it:
java -jar Azureus2.jar --ui=console >/dev/null 2>&1
- Make that file executable by typing
- Create a file called azureus_rcscript with the following in it: (you need to change the AZ_USER and DIR variables to represent the name of the user who will be running Azureus and the directory Azureus is installed to)
#rc script for Azureus by Phill - http://phillstechstuff.blogspot.com
#Based on script from Azureus wiki - http://www.azureuswiki.com/index.php/HeadlessSwingUIAtBoot
#The user that will run Azureus
AZ_USER=user
#your path to the azureus directory, where Azureus2.jar is located
DIR=/home/user/azureus
#executable files in the following paths that are perhaps needed by the script
PATH=/bin:/usr/bin:/sbin:/usr/sbin
#Description
DESC="Azureus daemon"
case "$1" in
start)
if [[ ` ps -ef | grep "java -jar Azureus2.jar --ui=console"|grep -v grep` ]]
then
echo "Azureus is already running!"
else
echo "Starting $DESC"
su $AZ_USER -c "cd $DIR; ./headless.sh"
fi
;;
stop)
if [[ ` ps -ef | grep "java -jar Azureus2.jar --ui=console"|grep -v grep` ]]
then
echo -n "Stopping $DESC"
su $AZ_USER -c "kill `ps -ef | grep "java -jar Azureus2.jar" | grep -v grep | awk '{print $2}'`"
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
;;
restart)
if [[ ` ps -ef | grep "java -jar Azureus2.jar --ui=console"|grep -v grep` ]]
then
echo -n "Stopping $DESC"
su $AZ_USER -c "kill `ps -ef | grep "java -jar Azureus2.jar" | grep -v grep | awk '{print $2}'`"
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
echo "Starting $DESC: $NAME"
su $AZ_USER -c "cd $DIR; ./headless.sh"
echo " ... done."
;;
status)
if [[ ` ps -ef | grep "java -jar Azureus2.jar --ui=console"|grep -v grep` ]]
then
echo "Azureus is RUNNING"
else
echo "Azureus is DOWN"
fi
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0
- Put that file inside the startup for the runlevel your machine runs at. For my machine, that is runlevel 5, and it is probably the same for yours if it boots up to a graphical environment. I did this by typing
mv azureus_rcscript.sh /etc/rc5.d/S99azureus_rcscript.sh
cp /etc/rc5.d/S99azureus_rcscript.sh /etc/rc5.d/K01azureus_rcscript.sh
chmod 755 /etc/rc5.d/S99azureus_rcscript.sh /etc/rc5.d/S99azureus_rcscript.sh
- The S99 makes it run this script after everything else has started up, which is good as it makes sure it won't try to run before things like network services have started. As the script also includes functionality to shut down Azureus, I copied it to have it run when we leave runlevel 5, which usually means shutdown time. The K01 means to run it before shutting down any other processes
Please let me know if this works for you, and if you have any questions!
11 comments:
Hi Phil,
Just tried this script out. Seems to launch azureus great (i can connect through html webui), but my linux box hangs during system startup. I get the message
"Starting azureus_rcscript.sh: Starting Azureus daemon", but it never goes to OK.
Any thoughts?
Thanks for the comment David. My first thoughts are:
The line it is hanging on is probably:
su $AZ_USER -c "cd $DIR; ./headless.sh"
Have you set the AZ_USER to a user that exists and has permission to run Azureus and DIR to the directory containing azureus? If you're using your own account (eg. david) and have decompressed all the files as that user then having something like:
AZ_USER=david
DIR=/home/david/azureus
should work.
If the above has been set correctly and it still isn't working then I'll need more information. It would help if you could give me an "ls -l" of your /etc/rc5.d/S99azureus_rcscript.sh, and also let me know if running "/etc/rc5.d/S99azureus_rcscript.sh
start" and "/etc/rc5.d/S99azureus_rcscript.sh stop" works
Thanks again for the feedback.
Hello phill,
It's been quite awhile since this posting. Are you still involved with this topic. I'm having the same problem as david had.
hi Phill,
this is a good alternative script to the official screen method, running azureus as a daemon
but do you think azureus can shutdown "tidily" when the process is simply killed?
Killing the java process with just the plain kill command gives it a chance to close properly. If the script called "kill -9" then no, it wouldn't close nicely.
P.S. Thanks Phill. The script works great for me in slackware (with some mods). I changed it so that it didn't rely on headless.sh for launching the program but instead just did it directly inside the script.
I've posted my modified version here:
http://docs.google.com/View?id=ddt54qhw_1f5hcwbg6
Anyone know what I need to change to make restart work properly?
Azureus Daemon in Slackware
Making clicky link.
I keep getting this error
/etc/init.d/azureus_rcscript.sh: 65: [[: not found
@Bferd
maybe line break at wrong place.
to avoid the kill, another approach is to use the telnetUI as below:
start azureus as with :
--ui=telnet (instead of --ui=console)
it will start a telnet server, for example:
changeLocale: no message properties for Locale 'English (United States)' (en_US), using 'English (default)'
Telnet server started. Listening on port: 57006
you have telnet access now (telnet 0 57006) to manage azureus
and to stop it, there is supported command "quit iamsure" which will stop (not kill) the app in regular way!
this is what i decided to use, hope it helps if you are interested :)
I get the [[: not found
my fix is change
#! /bin/sh
to
#! /bin/bash
Post a Comment