[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Un portable, plusieurs reseaux (probleme classique)



François TOURDE a écrit :

Le 12782ième jour après Epoch,
Patrice OLIVER écrivait:

Dans la configuration de whereami, j'ai compris qu'il faut à minima
configurer detect.conf et whereami.conf (c'est fait).

Tout à fait. Mais il y a aussi dans /etc/whereami des fichiers comme
apm.conf et ifplugd.conf

J'utilise acpid, et les fichiers ifplugd.* sont dans /etc
Pour acpi, je penses qu'il faut que je creuse un peu pour aller mettre des scripts adaptés dans /etc/acpi/events.
Il y en a un sur ma machine pour gérer l'appui du bouton marche/arrêt.

Faut-il lancer le service whereami au démarrage ou faut-il l'appeler
par ifplugd ?

Les deux. Et même plus. Normalement, whereami est lancé dans les cas
suivants:

/etc/init.d/whereami
/etc/apm/scripts.d/whereami
/etc/network/if-pre-up.d/whereami
symlinks: /etc/apm/suspend.d/01whereami
symlinks: /etc/apm/resume.d/99whereami

Ça donne donc: Démarrage, évennement apm, et if-pre-up ... J'ai
rajouté (ou peut-être est-ce l'install de whereami, je sais plus) le
cas de ifplugd (/etc/ifplugd/action.d/30whereami) (30 pour gérer
l'ordre)

Si oui, un petit exemple de  config ifplugd m'aiderait grandement.

Ci joint, le script que j'ai mis dans le répertoire
/etc/ifplugd/action.d

------------------------------------------------------------------------

#!/bin/sh
# $Id: whereami.ifplugd,v 1.6 2004/10/25 12:05:50 francois Exp $
# This script will run whereami on plug/unplug of the machine.
# If you have logger installed, whereami output will be sent to syslog.
#
# For example:
# SUSPEND_LOCATION=disconnected
# RESUME_LOCATION=auto

WHEREAMI=/usr/sbin/whereami
CONFIG=/etc/whereami/ifplugd.conf

[ -r $CONFIG ] || exit 0
[ -x $WHEREAMI ] || exit 0

. $CONFIG

case "$2" in
down)
	LOCATION=$UNPLUG_LOCATION
	;;
up)
	LOCATION=$PLUG_LOCATION
	;;
esac

[ -n "$LOCATION" ] || exit 0

[ "$LOCATION" = "auto" ] && LOCATION=

if [ -x /usr/bin/logger ] ; then
 logger -t whereami "IFPLUGD event $1 $2 whereami $LOCATION"
 $WHEREAMI --run_from ifplug --syslog $LOCATION | logger -t whereami
else
 $WHEREAMI --run_from ifplug --syslog $LOCATION
fi

------------------------------------------------------------------------


Comme d'hab, ce script est en GPL, si c'est moi qui l'ai
écrit/modifié, et sinon respecte la licence de l'auteur initial qui
est aussi GPL il me semble.
Merci, je regarde comment celà peut s'adapter chez moi.

Passes de bonnes fêtes de fin d'année,
Patrice.
:)




Reply to: