aMule Forum

English => aMule Help => Topic started by: jorlando on March 23, 2008, 11:17:06 PM

Title: amuleweb SVN running on background on gentoo
Post by: jorlando on March 23, 2008, 11:17:06 PM
I solved that problem a few hours ago and I want to share it to see  if other people experienced the same problem and found better solutions.

I downloaded the SVN for gentoo, emerged, configured and all is ok.

But, I wanted to run amuleweb on background, as a initd service so I could check/change/add downloads away from home.

At the command line I could run amuled and amuleweb, but as a initd service I could only get amuled, amuleweb would not start and give the message:

aMule daemon can't be started! Check logfile: /var/log/amuleweb.log

/var/log/amuleweb.log was empty and I couldn't figure out what was wrong. The fact that I could run both programs from command line get even more confused.

So I started to modify the /etc/init.d/amuleweb script, and removing the line that attempt to run amuleweb on background I could see that amuleweb was shutting down itself after being run.

Since amuleweb does not have a switch to run in background I used the -q& switch and it worked.

SVN version:
 # amuleweb --version
amuleweb SVN using wxGTK2 v2.8.7 (Snapshot: Sat Feb 16 07:02:15 CET 2008)


the /etc/init.d/amuleweb modified (modifications in bold red):

#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-p2p/amule/files/amuleweb.initd,v 1.5 2006/01/13 13:56:48 mkay Exp $

depend() {
   need net
   use amuled
}

start() {
   if ! test -f "${AMULEHOME}/.aMule/amule.conf"; then
      eerror "You must start and configure amuleweb before launch it. Sorry."
      return 1
   fi

   if pgrep -u ${AMULEUSER} amuleweb >/dev/null; then
      eerror "An instance of aMule webserver is already running"
      return 1
   fi

   rm /var/run/amuleweb.pid

   OPTIONS="-h ${AMULEHOST} -p ${AMULEPORT} -P ${AMULEPWD} -A ${WEBPWD}"

   ebegin "Starting aMule WebServer"
   env HOME="${AMULEHOME}" start-stop-daemon --start \
      --quiet -b \
      --make-pidfile --pidfile /var/run/amuleweb.pid \
      -c ${AMULEUSER} \
      -x /usr/bin/amuleweb -- ${OPTIONS} -q&>${LOG}
   
   sleep 1
   if ! pgrep -u ${AMULEUSER} amuleweb > /dev/null; then
      eerror "aMule daemon can't be started! Check logfile: ${LOG}"
      eend 1
      return 1
   fi
   eend $?
}

stop() {
   ebegin "Stopping aMule WebServer"
   start-stop-daemon --oknodo --stop --pidfile /var/run/amuleweb.pid &>/dev/null
   eend $?
}