Le tuto debian 6 est parfait, mais malheureusement, ne fonctionne pas en mode multiuser sous debian 6. En fait, le tuto n'est pas clair quant au fait que chaque utilisateur de rtorrent/rutorrent doit avoir sa propre instance lancée, je pensais à tort à lecture du tuto que rtorrent se forkait à chaque lancement de connexion, ce qui est faux. Dans ce même tuto, parfait par ailleurs, et vraiment clair pour les autres étapes échoue à l'étape de création du script sous init.d et sa validation par update-rc.d échoue, le système détectant un doublon à chaque script utilisateur. La solution est d'utiliser ce script pour lancer une instance de rtorrent pour chaque user utilisant la seedbox au boot, via rc.d, tout en conservant les mêmes éléments de la configuration écrite par nicobulle, que je remercie au passage pour son tuto clair et précis. Ce script résout le problème de connexion que rencontre chaque utilisateur qui souhaite lancer rtorrent, et recoit une erreur de type "Check if it is really running. Check $scgi_port and $ scgi_host settings in config.php and scgi_port in rTorrent" en lancant rutorrent sous les autres identités que l'identité principale qui lance rtorrent (user rtor, ou rtorrent selon les tutos). Pensez bien à vérifier que votre configuration rtorrent est fonctionnelle sous chaque identité (user) via l'utilisation de la commande su, en lancant rtorrent en ligne de commande avant tout déploiement, ceci vous évitera de longues heures de recherches (ctrl+q pour quitter rtorrent en mode invite)
Bon setup !
==========
#!/bin/bash
#
# /etc/init.d/rtorrent-user.<username>
#
# This script is designed to start/stop rtorrent embebbed into a screen
# session (detached) for any user known by the system (/etc/passwd).
# This script is user-dependent and should be duplicated (ln or ln -s
# recommanded) for each user (i.e. named rtorrent-user.joe for user joe).
#
# Correctly named, each instance of this script will start rtorrent into
# a screen session named rtorrent.<username>. Users will re-attach their
# rtorrent screen sessions using the following command:
# screen -r rtorrent.<username>
#
# Note that concerned users should have well configured their client
# (~/.rtorrent.rc configuration file) before this script is added to System V
# init files (use update-rc.d for this). This is important because rtorrent
# will be automatically started when entering runlevels 2345, and user's
# misconfigured rtorrent clients could involve an huge network traffic.
#
# By Nicolas Bercher, last update: 2010-07-18T13:13:08+02:00
#
nbercher@yahooo.fr
#
# This script is distributed under the terms of the GPL v2 license.
#
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start:
# Required-Stop:
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop screen embedded rtorrent client for user <username>
# Description: Start and stop screen embedded rtorrent client for user <username>.
### END INIT INFO
#
# Script rootname:
SCRIPTROOTNAME='rtorrent-user'
# found in /etc/init.d/mysql (@Debian/Lenny):
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
# Get the invoking username:
if [ $(dirname $SELF) == "/etc/init.d" ]; then
USERNAME=$(echo $(basename ${SELF}) | sed "s/\(${SCRIPTROOTNAME}.\)//g")
else
USERNAME=$(basename $(readlink ${SELF}) | sed "s/\(${SCRIPTROOTNAME}.\)//g")
fi
# Check if the script is not called as is:
if [ ${USERNAME} == "username" ]; then
echo 'Do not call this script directly, this script is user-dependent (not machine-dependent):'
echo 'you must create a symbolic link /etc/init.d/${SCRIPTROOTNAME}.<username> for the user <username> that points to this script.'
exit 1
fi
## Defines:
# found in /etc/init.d/mysql (@Debian/Lenny):
SERVICE_ID="${SCRIPTROOTNAME}.${USERNAME}"
LOCK_FILE="/var/lock/${SERVICE_ID}"
SERVICE_NAME="rtorrent"
START_COMMAND="screen -d -m -S ${SERVICE_NAME}.${USERNAME} -s ${SERVICE_NAME}"
# Check if the user exists:
if [ $(grep "^${USERNAME}\:" /etc/passwd | wc -l) != 1 ]; then
echo "Username <${USERNAME}> not found in /etc/password: unable to launch ${SERVICE_NAME}."
exit 1
fi
## Tests/Debug:
# echo "LOCK_FILE=${LOCK_FILE}"
# echo "USERNAME=${USERNAME}"
# echo "START_COMMAND=${START_COMMAND}"
## Carry out specific functions when asked to by the system
case "$1" in
start)
echo -n "Starting ${SERVICE_ID} service: "
if [ -f ${LOCK_FILE} ]; then
echo "${SERVICE_ID} is already running ! (lock file ${LOCK_FILE} exists)."
exit 1
else
touch ${LOCK_FILE}
su - ${USERNAME} -c "${START_COMMAND}"
echo "done !"
fi
;;
stop)
echo -n "Stopping ${SERVICE_ID} service: "
if [ ! -f ${LOCK_FILE} ]; then
echo "${SERVICE_ID} is not running ! (lock file ${LOCK_FILE} doesn't exists)."
else
rm -f ${LOCK_FILE}
pkill -U ${USERNAME} ${SERVICE_NAME}
echo "done !"
fi
;;
# Note: restart option disabled:
# Restart is buggy with screen/rtorrent and might need to wait a few seconds
# between stop & start (?).
# Inspired from /etc/init.d/mysql (@Debian/Lenny):
# restart)
# $SELF stop
# $SELF start
# ;;
status)
if [ -f ${LOCK_FILE} ]; then
echo "${SERVICE_ID} is running."
else
echo "${SERVICE_ID} is NOT running !"
fi
;;
*)
echo "Usage: ${0} {start|stop|status}"
exit 1
;;
esac
exit 0