View Full Version : Ubuntu 10.04: cambiare priorità a mldonkey con nice
Michele Spinolo
06-03-2011, 12:06
Ciao,
ho un serverino con mldonkey installato: parte automaticamente ma vorrei cambiare la priorità col comando "nice".
Non riesco però a capire dov'è in init il comando che lo fa partire: sapreste darmi una mano?
grazie
se parli di mldonkey-server
/etc/init.d/mldonkey-server
http://packages.ubuntu.com/lucid/i386/mldonkey-server/filelist
Michele Spinolo
06-03-2011, 17:59
se parli di mldonkey-server
/etc/init.d/mldonkey-server
http://packages.ubuntu.com/lucid/i386/mldonkey-server/filelist
si, sin qui ci sono arrivato ma dentro /etc/init.d/mldonkey-server non riesco a capire dove mettere il il comando nice.
Quello che ho dentro /etc/init.d/mldonkey-server è riportato sotto per intero.
C'è un punto in cui richiama nice (rosso grassetto) ma non capisco come dargli il valore di niceness:muro:
#!/bin/sh
#
# Original file :
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version: @(#)skeleton 1.9.1 08-Apr-2002 miquels@cistron.nl
#
#
# This file has been rewritten by Sylvain Le Gall <gildor@debian.org>
# and Samuel Mimram <smimram@debian.org> for the mldonkey package.
#
### BEGIN INIT INFO
# Provides: mldonkey-server
# Required-Start: $network
# Required-Stop: $network
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Server for the mldonkey peer-to-peer downloader.
# Description: Server for the mldonkey peer-to-peer downloader.
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=mlnet
EXEC=/usr/bin/$NAME
DESC="MLDonkey"
CONFIG=/etc/default/mldonkey-server
PIDDIR=/var/run/mldonkey
PIDFILE=$PIDDIR/$NAME.pid
LOGFILE=/var/log/mldonkey/mldonkey-server.log
SERVERLOG=/var/log/mldonkey/mlnet.log
test -e $CONFIG || exit 0
set -e
Warn ()
{
echo "$*" >&2
}
Error ()
{
code=$1
shift
echo "."
Warn "$DESC: $NAME [ERROR] $@"
exit $code
}
StartErrorCheck ()
{
if [ -f "$SERVERLOG" ] && tail -n 2 "$SERVERLOG" | grep -qi 'aborting' ; then
Warn "$DESC: $NAME [ERROR] server start error"
tail --verbose $SERVERLOG
exit 1
fi
}
. $CONFIG
# Look for the default locale
if [ -f "/etc/default/locale" ]; then
. /etc/default/locale
export LANG
fi
# /var/run might be on tempfs, see #354701.
if [ ! -d /var/run/mldonkey ]; then
mkdir -m 755 /var/run/mldonkey
fi
if [ ! -d /var/log/mldonkey ]; then
mkdir -m 755 /var/log/mldonkey
fi
if [ -n "$MLDONKEY_USER" ] && [ -n "$MLDONKEY_GROUP" ]; then
chown $MLDONKEY_USER:$MLDONKEY_GROUP /var/run/mldonkey
chown $MLDONKEY_USER:$MLDONKEY_GROUP /var/log/mldonkey
fi
WRAPPER_OPTIONS="--iosched idle"
# Set configuration value, from CONFIG
if [ -n "$MLDONKEY_USER" ] && [ -n "$MLDONKEY_GROUP" ]; then
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chuid $MLDONKEY_USER:$MLDONKEY_GROUP"
fi
if [ -n "$MLDONKEY_DIR" ]; then
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --chdir $MLDONKEY_DIR"
fi
if [ -n "$MLDONKEY_GROUP" ]; then
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --group $MLDONKEY_GROUP"
fi
if [ -n "$MLDONKEY_UMASK" ]; then
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --umask $MLDONKEY_UMASK"
fi
if [ -n "$MLDONKEY_NICENESS" ]; then
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --nicelevel $MLDONKEY_NICENESS"
fi
case "$1" in
start|force-start)
echo -n "Starting $DESC: $NAME"
if [ "x$LAUNCH_AT_STARTUP" != "xtrue" ] && [ "x$1" = "xstart" ]; then
Error 0 "configuration file prevent $NAME to be started (use force-start)."
fi
if [ -z "$MLDONKEY_DIR" ] || [ ! -d "$MLDONKEY_DIR" ]; then
if [ -z "$MLDONKEY_DIR" ]; then
MLDONKEY_DIR="(unset)"
fi
Error 1 "$MLDONKEY_DIR is not a valid directory."
fi
if [ ! -f "$MLDONKEY_DIR/downloads.ini" ]; then
Error 1 "$MLDONKEY_DIR/downloads.ini is not a valid file."
fi
USER=`/usr/bin/stat --format="%U" "$MLDONKEY_DIR/downloads.ini"`
WRAPPER_OPTIONS="$WRAPPER_OPTIONS --user $USER"
start-stop-daemon --start $WRAPPER_OPTIONS \
--pidfile $PIDFILE --background --exec $EXEC \
-- -log_file $SERVERLOG -pid $PIDDIR 2>&1
StartErrorCheck
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
start-stop-daemon --stop --oknodo --pidfile $PIDFILE --retry 30
echo "."
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
Error 1 "Usage: $0 {start|stop|restart|force-reload|force-start}"
;;
esac
exit 0
Ad occhio, ti direi di controllare il file puntato dalla variabile $CONFIG, il cui contenuto viene incluso ad un certo punto dello script.
Michele Spinolo
06-03-2011, 18:11
Ad occhio, ti direi di controllare il file puntato dalla variabile $CONFIG, il cui contenuto viene incluso ad un certo punto dello script.
questo file è vuoto :cry:
hai valorizzato la variabile:
MLDONKEY_NICENESS
?
Michele Spinolo
06-03-2011, 23:01
hai valorizzato la variabile:
MLDONKEY_NICENESS
?
No...non ho idea di come si faccia: non me la cavo tanto bene con Linux!
proverei:
a aggiungere alla cima dello script:
MLDONKEY_NICENESS=<valore di nice>
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.