# démon connexion ?

**URL:** <https://www.debian-fr.org/t/demon-connexion/14857>\
**Category:** Programmation\
**Created:** [Février 20, 2016, 5:54 UTC](https://www.debian-fr.org/t/demon-connexion/14857 "2016-02-20T17:54:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kran](https://www.debian-fr.org/letter_avatar_proxy/v4/letter/k/c0e974/32.png) [@kran](https://www.debian-fr.org/u/kran)\
**Post date:** [Février 20, 2016, 5:54 UTC](https://www.debian-fr.org/t/demon-connexion/14857/1 "2016-02-20T17:54:00Z")

</div>

Salut à tous, je fais une application qui a pour but d’installer des mises à jour sur une architecture arm et je me demandais si il existait un moyen (un démon par exemple) pour exécuter une application dès que le système est connecté à Internet ? (ou que la connexion est disponible, par exemple : je branche mon câble ethernet et paf le logiciel se lance …)

Nico

---

<div class="post-metadata">

**Author:** ![Desintegr](https://www.debian-fr.org/user_avatar/www.debian-fr.org/desintegr/32/3771_2.png) [@Desintegr](https://www.debian-fr.org/u/Desintegr)\
**Post date:** [Février 20, 2016, 5:55 UTC](https://www.debian-fr.org/t/demon-connexion/14857/2 "2016-02-20T17:55:11Z")

</div>

Tu peux peut-être regarder du côté de ifplugd. Et plus particulièrement son option -r (run) :

[quote]Specify program to execute when link status changes (default: /etc/ifplugd/ifplugd.action)  
/etc/ifplugd/ifplugd.action: this is the script which will be called by the daemon whenever the state of the interface changes. It takes two areguments: the first is the interface name (eg. eth0), the second either “up” or “down”.[/quote]  
[0pointer.de/lennart/projects/ifplugd/](http://0pointer.de/lennart/projects/ifplugd/)

Disponible également dans le dépôt stable : [packages.debian.org/etch/ifplugd](http://packages.debian.org/etch/ifplugd)

---

<div class="post-metadata">

**Author:** ![mattotop](https://www.debian-fr.org/user_avatar/www.debian-fr.org/mattotop/32/3942_2.png) [@mattotop](https://www.debian-fr.org/u/mattotop)\
**Post date:** [Février 20, 2016, 5:55 UTC](https://www.debian-fr.org/t/demon-connexion/14857/3 "2016-02-20T17:55:13Z")

</div>

Tu peux aussi mettre une instruction up \<commande à executer\> dans la section d’/etc/network/interfaces qui correspond à ton interface. C’est pas idéal pour les interfaces statiques, mais pour les interfaces dhcp, le up ne s’execute que quand l’adresse est attribuée.  
Il y a aussi le paquet whereami, un peu plus riche que ifplugd mais plus compliqué à utiliser, et qui peut être utile pour tester les conditions et décider si tu lances ton operation de màj ou pas (ça fait des ping et ça sniffe des choses sur le réseau pour savoir si en plus du link actif, tu as une vraie connection):

[quote]roc@roc:~/public\_html/lscomgmt$ aptitude show whereami  
Paquet : whereami  
Nouveau: oui  
État: installé  
Automatiquement installé: non  
Version : 0.3.34-0.1  
Priorité : supplémentaire  
Section : net  
Responsable : Andrew McMillan [debian@mcmillan.net.nz](mailto:debian@mcmillan.net.nz)  
Taille décompressée : 291k  
Dépend: debconf (\>= 1.2.9) | debconf-2.0, fping | iputils-ping | netbase | dhcp-client, perl  
Recommande: iputils-arping, resolvconf, wireless-tools  
Suggère: ethtool, fping, ifplugd, net-tools, pcmcia-cs, squid | oops  
Description : Automatically reconfigure your (laptop) system for a new location  
whereami is a set of useful scripts and a coordinating system for automatically re-locating your computer within the current (network) environment.

Typically, you would use whereami to automatically detect and re-configure your laptop when you move between a variety of diverse networks and/or docking  
environments.

Although whereami will work best if all of your networks assign addresses through dhcp, this is not a pre-requisite and the system allows any technique to  
be used to ascertain the new location with as little ongoing user intervention as possible.

Having ascertained the correct location, whereami will run appropriate (user-configured) scripts to adjust the laptop operation to suit the current  
environment.

See the man pages for more information. You may also get useful assistance from the debian-laptop mailing list, which is frequented by several of the  
users and contributors.

Étiquettes: hardware::laptop, implemented-in::perl, implemented-in::shell, network::configuration, protocol::dhcp, role::program, scope::utility [/quote]
