diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/mldonkey/mldonkeyd |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/mldonkey/mldonkeyd')
-rw-r--r-- | community/mldonkey/mldonkeyd | 50 |
1 files changed, 50 insertions, 0 deletions
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 |