bash script ausführen wenn "link state changed to UP/DOWN"

jprinzler

Member
Hallo !

Kann man bei FreeBSD (6.3) ein Script angeben welchen bei Verlust bzw.
Wiederherstellung der Netzwerkverbindung ausgeführt wird? Und wenn ja wo?

Der Verlust der Verbindung aüßert sich in "/var/log/messages" so:

> Aug 20 05:11:31 xyzserver kernel: em0: link state changed to DOWN
> Aug 20 07:00:32 xyzserver kernel: em0: link state changed to UP

Danke für Eure Tipps!

...Jaro
 
Hi jprinzler,

Hallo !

Kann man bei FreeBSD (6.3) ein Script angeben welchen bei Verlust bzw.
Wiederherstellung der Netzwerkverbindung ausgeführt wird? Und wenn ja wo?

Der Verlust der Verbindung aüßert sich in "/var/log/messages" so:

> Aug 20 05:11:31 xyzserver kernel: em0: link state changed to DOWN
> Aug 20 07:00:32 xyzserver kernel: em0: link state changed to UP

Danke für Eure Tipps!

...Jaro

Schau mal hier: man devd.conf

Viele Grüße

JueDan
 
Danke für den Tipp - bin damit schon ein wenig weiter.
Ich habe habe also folgendes in die "devd.conf" geschrieben:

notify 0 {
match "system" "IFNET";
match "subsystem" "em0";
match "type" "LINK_DOWN";
action "/data/bin/script_network_state down em0";
};

notify 0 {
match "system" "IFNET";
match "subsystem" "em0";
match "type" "LINK_UP";
action "/data/bin/script_network_state up em0";
};

Nur leider wird nur LINK_DOWN und nicht LINK_UP erkannt?
Gibts hier noch einen Schubs von Dir?

...Jaro
 
Moin,

Nur leider wird nur LINK_DOWN und nicht LINK_UP erkannt?
Gibts hier noch einen Schubs von Dir?

...Jaro

Du kannst zusätzlich noch ifstated einsetzen, welches den Status einer Netzverbindung überwacht.
LINK_UP/DOWN: Kabel rein, Kabel raus
ATTACH/DETACH: Karte rein, Karte raus.
Wenn Du das kombinierst, hast Du eine universelle Lösung.

So long
 
Hallo !

Habe hin bekommen mittels:

notify 100 {
match "system" "IFNET";
match "subsystem" "em0|vr0";
match "type" "LINK_UP";
action "/data/bin/script_network_state $type $subsystem";
};

notify 100 {
match "system" "IFNET";
match "subsystem" "em0|vr0";
match "type" "LINK_DOWN";
action "/data/bin/script_network_state $type $subsystem";
};

Es lag wohl an "notify 100" statt "notify 0" ;-)

Danke ! Jaro !
 
Zurück
Oben