#!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ depend() { need net need amuled } TIMEOUT=10 start() { if ! test -d "$AMULEHOME/.aMule"; 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 OPTIONS="-h $AMULEHOST -p $AMULEPORT -P $AMULEPWD" einfo "$OPTIONS" ebegin "Starting aMule WebServer" env HOME="$AMULEHOME" start-stop-daemon --start \ --quiet --background \ --make-pidfile --pidfile /var/run/amuleweb.pid \ -c "$AMULEUSER" \ -x /usr/bin/amuleweb -- --quiet $OPTIONS &>"$LOG" START="$(date +%s)" until pgrep -u "$AMULEUSER" amuleweb > /dev/null; do if [ "$(date +%s)" -gt "$(($START+$TIMEOUT))" ]; then eerror "aMule WebServer can't be started! Check logfile: $LOG" return 1 fi done eend $? } stop() { ebegin "Stopping aMule WebServer" start-stop-daemon --stop --pidfile /var/run/amuleweb.pid --retry "$TIMEOUT" >/dev/null eend $? }