Fix epatch invocation again, add missing files.
[overlay.git] / net-p2p / amule / files / amuleweb.initd
1 #!/sbin/runscript
2 # Copyright 1999-2007 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Header: /var/cvsroot/gentoo-x86/net-p2p/amule/files/amuleweb.initd,v 1.7 2008/02/04 16:51:51 armin76 Exp $
5
6 depend() {
7         need net
8         use amuled
9 }
10
11 start() {
12         if ! test -f "${AMULEHOME}/.aMule/amule.conf"; then
13                 eerror "You must start and configure amuleweb before launch it. Sorry."
14                 return 1
15         fi
16
17         if pgrep -u ${AMULEUSER} amuleweb >/dev/null; then
18                 eerror "An instance of aMule webserver is already running"
19                 return 1
20         fi
21
22         if [ -e /var/run/amuleweb.pid ]; then
23                 rm /var/run/amuleweb.pid
24         fi
25
26         OPTIONS="-h ${AMULEHOST} -p ${AMULEPORT} -P ${AMULEPWD} -A ${WEBPWD} -t ${TEMPLATE} -q"
27
28         ebegin "Starting aMule WebServer"
29         env HOME="${AMULEHOME}" start-stop-daemon --start \
30                 --quiet -b \
31                 --make-pidfile --pidfile /var/run/amuleweb.pid \
32                 -c ${AMULEUSER} \
33                 -x /usr/bin/amuleweb -- ${OPTIONS} &>${LOG}
34         
35         sleep 1
36         if ! pgrep -u ${AMULEUSER} amuleweb > /dev/null; then
37                 eerror "aMule daemon can't be started! Check logfile: ${LOG}"
38                 eend 1
39                 return 1
40         fi
41         eend $?
42 }
43
44 stop() {
45         ebegin "Stopping aMule WebServer"
46         start-stop-daemon --oknodo --stop --pidfile /var/run/amuleweb.pid &>/dev/null
47         eend $?
48 }
49