tquille
Posts: 4
Joined: Mon Mar 24, 2014 8:19 pm

Run a script each time the network interface change

Mon Mar 24, 2014 8:27 pm

Hi,

I would like excecute a bash script each time the network interface change his state to UP.

For this, i would like use the command "post-up" in the file "/etc/network/interfaces", but this file is empty :)

Can you help me to launch a script when i up my network interface ?

Best regards,

Chris

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Run a script each time the network interface change

Tue Mar 25, 2014 1:37 am

You have the if-pre-up and the if-up directories. if-up is run after the interface comes up, so that's the one you want. Just put your script, or a symlink to it, in this directory and it will be run after the interface comes up every time. (I don't know the order that these scripts are run; probably alphabetical ascending, but google it if it matters for your application.)

tquille
Posts: 4
Joined: Mon Mar 24, 2014 8:19 pm

Re: Run a script each time the network interface change

Tue Mar 25, 2014 9:23 pm

Thank you, it's works.

Bye

Return to “Advanced users”