TOP
SSV Software Systems Register  Register
Log in to check your private messages  Log in to check your private messages
Startseite FAQ Search Mitglieder Profile  Log in 
SSV Support-Forum
Programmstart beim Einstecken des Netzwerksteckers

 
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9265
<<< Previous topic - Next topic >>>  
Display posts from previous:   
Author Message
MrQ



Joined: 02 Sep 2011
Posts: 1

PostPosted: 11.05.2012, 14:18    Post subject: Programmstart beim Einstecken des Netzwerksteckers Reply with quote

Hallo,

ich möchte beim Einstecken und Rausziehen des Netzwerksteckers ein Programm starten.
Wie kann ich das am besten realisieren?

Gruß Jens Ramhorst
Back to top
View user's profile Send private message
hne



Joined: 11 Jul 2008
Posts: 210
Location: Hannover

PostPosted: 01.06.2012, 18:38    Post subject: Reply with quote

Zum Beispiel ein kleines Script schreiben, dass zyklisch schaut, ob das Kabel gesteckt oder gezogen wurde:

Hier ein Beispiel:
Code:
#!/bin/sh

while true
do
        while [ `cat /sys/class/net/eth0/carrier` = "0" ]
        do
                sleep 5
        done
        logger -t lanwatch "Link is up"

        while [ `cat /sys/class/net/eth0/carrier` = "1" ]
        do
                sleep 5
        done
        logger -t lanwatch "Link is down"
done


Diesen Script so starten:
Code:
./lanwatch.sh </dev/null >/dev/null 2>&1 &


In dem Beispiel wird jeweils eine Zeile per Programm "logger" im Syslog ausgegeben. Genauso kann man dort eigene Programme starten. Zum Debuggen einfach das obige Script ohne die Umleitungen nach /dev/null starten.
_________________
Henry Nestler
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9265 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

SSV Software Systems GmbH

Dünenweg 5
30419 Hannover

Fon: +49(0)511  ·  40 000-0
Fax: +49(0)511  ·  40 000-40

sales@ssv-embedded.de


Impressum    ·    Datenschutz    ·    AGB

© 2023 SSV SOFTWARE SYSTEMS GmbH. Alle Rechte vorbehalten.

ISO 9001:2015