AMule

From ArchWiki
Revision as of 19:59, 25 January 2010 by Cchabanois (Talk | contribs) (amuled service)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

aMule is an eMule-like client for the eD2k and Kademlia networks, supporting multiple platforms.

amuled

aMuled is a full featured aMule, running without any user interface (GUI). It is controlled by remote access through aMuleWeb, or aMuleGUI.

We will create a service for amuled and amuleweb.

Create a user that will run the services

We create a user and run amuled and amuleweb once to create the configuration files :

#sudo useradd -m -s /bin/bash p2p
#sudo su p2p
#amuled --ec-config

Choose a password (amule for example) and then stop amuled using Ctrl-C. Start amuleweb too to create the configuration file :

#amuleweb --write-config --password=amule --admin-pass=amule

We can now set p2p's shell to /bin/false as we don't want to give it shell access to the machine.

Edit /etc/password and replace /bin/bash by /bin/false

 p2p:x:1001:1001::/home/p2p:/bin/false


amuled service

Create /etc/rc.d/amuled :

#!/bin/bash                                                                                                  

NAME=$(basename "$0")
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/amuled                                           
WEB=/usr/bin/amuleweb                                            
DESC=amuled                                                      
USER=p2p #A user who already ran amule once to configure it.     

test -x "$DAEMON" || exit 0

case "$1" in
 start)     
   echo -n "Starting $DESC: "
       su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
       su "$USER" -c "$(printf "%q --quiet &" "$WEB" )"
   echo "$NAME."
   ;;
 stop)
   echo -n "Stopping $DESC: "
     killall --quiet --ignore-case "$WEB"
     killall --quiet --ignore-case "$DAEMON"
   echo "$NAME."
   ;;
 restart|force-reload)
   echo -n "Restarting $DESC: "
       killall --quiet --ignore-case "$WEB"
       killall --quiet --ignore-case "$DAEMON"
   sleep 1
       su $USER -c "$DAEMON -f"
       su $USER -c "$WEB --quiet &"
   echo "$NAME."
   ;;
 *)
   printf "Usage: %q {start|stop|restart|force-reload}\n" "$0" >&2
   exit 1
   ;;
esac

exit 0

Make it runnable :

#sudo chmod 755 /etc/rc.d/amuled

You can now use amuleGui to connect to amuled remotely. You can also use connect to amuleweb using http://yourserver:4711/