Are all scripts in /etc/network/if-up.d run when a network interface is brought up?
If so, what is the post-up command for in the interfaces file?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Yes generally any script that is marked as executable and placed in that folder is ran. The files do have are limited to a specific set of names because run-parts is used.
post-up does the same thing as using
up. Placing a script in the if-up.d is the same as simply using a
post-up that points to a script or command somewhere else. Usually you would use the up|post-up when you just needed to run a single command for a single interface. When you have something more complex you would create a script.
... up command post-up command Run command after bringing the interface up. If this command fails then ifup aborts, refraining from marking the interface as configured (even though it has really been configured), prints an error message, and exits with status 0. This behavior may change in the future. ... There exists for each of the above mentioned options a directory /etc/network/if-<option>.d/ the scripts in which are run (with no argu- ments) using run-parts(8) after the option itself has been processed.
run-parts runs all the executable files named within constraints described below, If the --lsbsysinit option is not given then the names must consist entirely of upper and lower case letters, digits, underscores, and hyphens. ... Files are run in the lexical sort order of their names unless the --reverse option is given, in which case they are run in the opposite order.