From 415856bdd4f48ab4f2732996f0bae58595092bbe Mon Sep 17 00:00:00 2001 From: Parabola Date: Tue, 5 Apr 2011 14:26:38 +0000 Subject: Tue Apr 5 14:26:38 UTC 2011 --- community/mldonkey/mldonkeyd | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 community/mldonkey/mldonkeyd (limited to 'community/mldonkey/mldonkeyd') diff --git a/community/mldonkey/mldonkeyd b/community/mldonkey/mldonkeyd new file mode 100644 index 000000000..bbd6954c2 --- /dev/null +++ b/community/mldonkey/mldonkeyd @@ -0,0 +1,50 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/conf.d/mldonkey +. /etc/rc.d/functions + +if [ -z $MLDUSER ] ; then + echo "Unable to run MLDonkey. You must set a user in /etc/conf.d/mldonkey ." + exit 2 +fi + +USERDIR=$(getent passwd $MLDUSER | cut -d: -f6) + +if [ ! -d $USERDIR ]; then + echo "Unable to run MLDonkey. Home directory for ${MLDUSER} does not exist." + exit 2 +fi + +PID=$(cat $USERDIR/.mldonkey/mlnet.pid 2>/dev/null) + +case "$1" in + start) + stat_busy "Starting MLDonkey" + [ -z $PID ] && su $MLDUSER -s /bin/sh -c "/usr/bin/mlnet $PARAMS -log_to_syslog true &> /tmp/mldonkey.log &" + if [ $? -gt 0 ]; then + stat_fail + else + add_daemon mldonkey + 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 + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac +exit 0 -- cgit v1.2.3-54-g00ecf