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.
:)


Répondre à