Linux – running a script after ETH0 comes up.

Leave a comment

June 5, 2013 by aubreykloppers

Ok, this is very easy, but took me a while to figure out.

Once your interface has a static IP, all you have to do is edit /etc/network/interfaces and add the last line:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
post-up /etc/network/if-up.d/<script>

that’s it!  Now, when your server comes up and the network is active, the script will run.  I use this to mount CIFS files (Samba), starting Calibra-server and more…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

counter for wordpress
%d bloggers like this: