summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-p2p/amule/files/amuleweb.initd')
-rw-r--r--net-p2p/amule/files/amuleweb.initd48
1 files changed, 48 insertions, 0 deletions
diff --git a/net-p2p/amule/files/amuleweb.initd b/net-p2p/amule/files/amuleweb.initd
new file mode 100644
index 000000000000..00036b4f0521
--- /dev/null
+++ b/net-p2p/amule/files/amuleweb.initd
@@ -0,0 +1,48 @@
+#!/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.1 2005/07/10 15:02:47 chainsaw Exp $
+
+depend() {
+ need net
+ use amuled
+}
+
+start() {
+ if ! test -f "${AMULEHOME}/.eMule"; 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="-rh ${AMULEHOST} -p ${AMULEPORT} -pw ${AMULEPWD}"
+
+ einfo $OPTIONS
+ 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} &>${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 $?
+}
+