Hier mein init.d skript mldonkey :
- Code: Alles auswählen
#################################################
###SRCIPT BEGIN
###############################################
#!/bin/sh
#
# MLdonkey: start/stop script - (c) 2003 Lucas Peetz Dulley
# (c) 2005 Killservice G.Z.
# 1) corrected for Fedora Core 3 and 4
# 2) added chkconfig posibility
#
# chkconfig: 2345 99 20
# description: MLdonkey
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# DESCRIPTION:
# An useful and simple(?) script for starting, stopping and restarting
# MLDonkey as a daemon.
#
# REQUIRES:
# - bash, ps, wc, grep, awk and netcat.
#
# INSTALL:
# - become root
# - copy this file to /etc/init.d/
# - make the file executable "chmod +x /etc/init.d/MLDonkey"
# - run "chkconfig --add MLDonkey"
# (obsolete) - create links in the rc.* (in Debian: "update-rc.d MLDonkey defaults")
#
# USAGE:
# - run "/etc/init.d/MLDonkey start" (to start)
# - run "/etc/init.d/MLDonkey stop" (to stop)
# - run "/etc/init.d/MLDonkey restart" (to restart)
#
## BEGIN USER CONFIGURATION ##
#
# Set running directory and username (not root).
MLDONKEYDIR=/srv/p2p_pool/mldonkey/.mldonkey
ML_NET="./mlnet"
USERNAME=mldonkey
#
# Set Netcat's (TCP/IP swiss army knife) filename - usually "nc" or "netcat"
NETCAT=nc
#
## END USER CONFIGURATION ##
status() {
PID=`ps ax -o "pid user command" | egrep -m 1 \{3\}./mlnet | awk {'print $1'}`
if [ $PID ];then
if [ `ps -p $PID | wc -l` -eq 2 ]; then
echo "mldonkey (pid $PID) running..."
return 1
else
echo "Stale PID"
fi
fi
echo "mldonkey is stopped"
return 0
}
start() {
# see if there is a mldonkey running
status &> /dev/null
if [ $? = 0 ]; then
echo "Starting mldonkey:"
cd /srv/p2p_pool/mldonkey/.mldonkey
# # Remove old servers
# rm -rf servers.ini*
# Remove tmp files
rm -rf *.tmp
cd /
cd /srv/p2p_pool/mldonkey
# Run MLDonkey
su mldonkey -c "./mlnet > /dev/null 2>&1 &"
fi
return 0
}
stop() {
status &> /dev/null
if [ $? = 1 ]; then
echo "Stopping mldonkey:"
cd /srv/p2p_pool/mldonkey/.mldonkey
start-stop-daemon --stop --quiet --pidfile /srv/p2p_pool/mldonkey/.mldonkey/mlnet.pid
sleep 10
return 0
fi
return 1
}
case "$1" in
'status')
status ;;
'start')
start ;;
'stop')
stop ;;
'restart')
stop
start ;;
*)
echo "usage $0 start|stop|restart"
exit 1 ;;
esac
exit $?
##-- eof
###############################################
###SCRIPT END
###############################################
Wenn man die downloads.ini editieren will sollte man sich vorher mit
- Code: Alles auswählen
su mldonkey
als user mldonkey anmelden!
Axo : die mlnet Datei sollte in /srv/p2p_pool/mldonkey/ liegen. Oder man passt das Skript entsprechend an! Irgendwie habe ich immer Probleme gehabt wenn ich mit Variablen arbeite (sorry - bin Linux newbie). Die Konfigfiles liegen in /srv/p2p_pool/mldonkey/.mldonkey





