FAQ amuled-fr

From AMule Project FAQ
Revision as of 09:36, 12 January 2009 by Suske (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

TRADUCTION EN COURS - N'hésitez pas à contribuer

Script de démarrage

Ceci est un script de démarrage pour 'amuled' qui entraînera le démmarrage et l'arrêt de 'amuled' en meme temps que votre ordinateur. Il est dérivé de celui d'aMuleWeb, mais suit des règles de "quoting" plus strictes, ne nécessite pas de fichier de configuration dans /etc/defaults, et ne démarre pas de serveur web.

Run su, or prefix commands with sudo, to become root.

Edit the USER= line to set it to your current user (as reported by whoami).

Copy the script as /etc/init.d/amuled:

cp amuled /etc/init.d/amuled

Make it executable:

chmod 755 /etc/init.d/amuled

Set it to run at startup:

 #on Debian distros:
 update-rc.d amuled defaults
 #on Red Hat distros:
 chkconfig --add amuled
 chkconfig amuled on 2 3 5 .
 #on a generic distro
 ln -s /etc/init.d/amuled /etc/rc0.d/K20amuled;
 ln -s /etc/init.d/amuled /etc/rc1.d/K20amuled;
 ln -s /etc/init.d/amuled /etc/rc6.d/K20amuled;
 ln -s /etc/init.d/amuled /etc/rc4.d/S20amuled
 ln -s /etc/init.d/amuled /etc/rc5.d/S20amuled

The script contains the following lines:

#!/bin/bash

NAME=$(basename "$0")
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/amuled
DESC=amuled
USER=g2p #A user who already ran amule once to configure it.

test -x "$DAEMON" || exit 0

case "$1" in
 start)
   echo -n "Starting $DESC: "
     su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
   echo "$NAME."
   ;;
 stop)
   echo -n "Stopping $DESC: "
     killall --quiet "$DAEMON"
   echo "$NAME."
   ;;
 restart|force-reload)
   echo -n "Restarting $DESC: "
     killall --quiet "$DAEMON"
   sleep 1
     su "$USER" -c "$(printf "%q -f" "$DAEMON" )"
   ;;
 *)
   printf "Usage: %q {start|stop|restart|force-reload}\n" "$0" >&2
   exit 1
   ;;
esac

exit 0