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

Re: Un portable, plusieurs reseaux (probleme classique)



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

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

Reply to: