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