From 4bc61018eec54dbe50e7556ce01d2ef2859b2c9f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 9 Feb 2012 23:14:54 +0000 Subject: Thu Feb 9 23:14:54 UTC 2012 --- community/mldonkey/PKGBUILD | 6 +++--- community/mldonkey/mldonkeyd | 44 +++++++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'community/mldonkey') diff --git a/community/mldonkey/PKGBUILD b/community/mldonkey/PKGBUILD index ea5a0f175..fc9961fb1 100644 --- a/community/mldonkey/PKGBUILD +++ b/community/mldonkey/PKGBUILD @@ -1,11 +1,11 @@ -# $Id: PKGBUILD 63664 2012-02-05 12:04:35Z ibiru $ +# $Id: PKGBUILD 64114 2012-02-08 23:57:08Z cbrannon $ # Maintainer: Chris Brannon # Contributor: Corrado Primier # Contributor: Alessio 'mOLOk' Bolognino pkgname=mldonkey pkgver=3.1.0 -pkgrel=2 +pkgrel=3 pkgdesc="A multi-network P2P client" arch=('i686' 'x86_64') url="http://mldonkey.sourceforge.net/" @@ -41,6 +41,6 @@ package() { install -Dm644 "$srcdir/mldonkey.conf" "$pkgdir/etc/conf.d/mldonkey" } md5sums=('072726d158ba1e936c554be341e7ceff' - '75e4b6c7fb282f7de15a8d5478f3bd70' + '9e90003a012cf17b548dcc647961ffa6' '1f86d92db51c62cded0e6f3833057dee' '1de3266caa49f82bee73ba891eea12cf') diff --git a/community/mldonkey/mldonkeyd b/community/mldonkey/mldonkeyd index 6a458d68e..533aa751c 100644 --- a/community/mldonkey/mldonkeyd +++ b/community/mldonkey/mldonkeyd @@ -1,8 +1,8 @@ #!/bin/bash . /etc/rc.conf -. /etc/conf.d/mldonkey . /etc/rc.d/functions +. /etc/conf.d/mldonkey if [ -z $MLDUSER ] ; then echo "Unable to run MLDonkey. You must set a user in /etc/conf.d/mldonkey ." @@ -27,7 +27,10 @@ fi PIDDIR="/var/run/mldonkey" PIDFILE="$PIDDIR/mlnet.pid" -PID=$(cat $PIDFILE 2>/dev/null) + +getPID() { + echo $(pgrep -u "$MLDUSER" mlnet 2>/dev/null); +} case "$1" in start) @@ -46,19 +49,34 @@ case "$1" in stat_done fi ;; - stop) - stat_busy "Stopping MLDonkey" - [ ! -z $PID ] && kill $PID &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon mldonkey - stat_done - fi - ;; + stop) + stat_busy "Stopping MLDonkey" + if [ ! -z "$(getPID)" ]; then + timeo=30 + kill $(getPID) &> /dev/null + if [ $? -gt 0 ]; then + stat_fail + exit 1 + fi + while [ ! -z "$(getPID)" -a $timeo -gt 0 ]; do + sleep 1 + let timeo=${timeo}-1 + done + if [ -z "$(getPID)" ]; then + rm -f $PIDFILE &>/dev/null + rm_daemon mldonkey + stat_done + else + stat_fail + exit 1 + fi + else + stat_fail + exit 1 + fi + ;; restart) $0 stop - sleep 1 $0 start ;; *) -- cgit v1.2.3-54-g00ecf