diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-p2p/amule/files/amuleweb.initd |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-p2p/amule/files/amuleweb.initd')
-rw-r--r-- | net-p2p/amule/files/amuleweb.initd | 49 |
1 files changed, 49 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..bf00fcde5d4a --- /dev/null +++ b/net-p2p/amule/files/amuleweb.initd @@ -0,0 +1,49 @@ +#!/sbin/openrc-run +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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 + + if [ -e /var/run/amuleweb.pid ]; then + rm /var/run/amuleweb.pid + fi + + OPTIONS="-h ${AMULEHOST} -p ${AMULEPORT} -P ${AMULEPWD} -A ${WEBPWD} -t ${TEMPLATE} -q" + + ebegin "Starting aMule WebServer" + start-stop-daemon --start \ + --quiet --background \ + --make-pidfile --pidfile /var/run/amuleweb.pid \ + --env HOME="${AMULEHOME}" \ + --user ${AMULEUSER} \ + --exec /usr/bin/amuleweb -- ${OPTIONS} 2>&1 >${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 --stop --pidfile /var/run/amuleweb.pid 2>&1 >/dev/null + eend $? +} + |