How to execute a script once an interface is up or down?

Using applications, configuring, problems
Post Reply
Message
Author
boolean

How to execute a script once an interface is up or down?

#1 Post by boolean »

puppy have an unusual interface management , so the internet is not helping

any idea?

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#2 Post by slavvo67 »

Your questions is worded a little strange. Can you elaborate a little? Puppy has a terminal in which you can execute scripts. In addition, you can create scripts and save them in root/my-applications/bin. You also have to set the script as executable.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#3 Post by Semme »

So long as DHCP's running, it's "ifconfig eth0 up" for me. Down drops it. If you meant wireless, look @ these examples.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

boolean

#4 Post by boolean »

EDIT: i meant after i bring an interface up , like : ifconfig eth0 up, i would like for a script(specific to that NIC) to be automatically executed ;

like this question here:

http://www.cyberciti.biz/tips/how-do-i- ... gs-up.html

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#5 Post by Semme »

It's OK, the next person can ask.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#6 Post by mikeb »

I use this loop at the beginning of a keep alive/NFS scan script...it basically polls the network until the internet appears... it might be adaptable for your use..you could probably drop the SUBNET bit and just check for ANY output

Code: Select all

while [ "$SUBNET" = "" ]; do
	SUBNET=$(ifconfig | grep inet | grep -v 127.0.0.1 | awk '{print $2}' | cut -d ':' -f 2)
	sleep 20
done
mike

Post Reply