ifup and run-parts

Denys Vlasenko vda.linux at googlemail.com
Tue Jan 25 18:07:04 UTC 2011


On Tue, Jan 25, 2011 at 5:04 PM, David Collier
<from_busybox_maillist at dexdyne.com> wrote:
> I'm trying to get to grips with what the /etc/network/if-up.d ( and
> friends ) scripts are all about.
>
> As far as I can see they are automatically invoked by ifup and ifdown
>
> Is that the only thing that calls them?
>
> D
>
> ====================================================
>
> One thing that puzzles me - I see this
>
>    run-parts /etc/network/if-down.d
>    ifconfig lo 127.0.0.1 down
>    run-parts /etc/network/if-post-down.d
>
>    run-parts /etc/network/if-down.d
>    ifconfig eth0 down
>    run-parts /etc/network/if-post-down.d
>
> but how are the scripts in if-down.d to know if they are to run or not,
> assuming they actually only apply to a single interface?

$IFACE

> should it not do
>
>    run-parts /etc/network/if-down.d       -a lo
>    ifconfig lo 127.0.0.1 down
>    run-parts /etc/network/if-post-down.d  -a lo
>
>    run-parts /etc/network/if-down.d       -a eth0
>    ifconfig eth0 down
>    run-parts /etc/network/if-post-down.d  -a eth0

Only in "standard" ifup/down does that too.

> or is there some other environment variable that allows the scripts to
> work out if it's their own personal interface that's being operated on?
>
> I assume I can make, and maybe submit, a patch to this line
>
>        buf = xasprintf("run-parts /etc/network/if-%s.d", opt);
>
> in ifupdown.c to add the "-a <interface>" which I think is such a good
> idea!
>
> ----------------------------------------------------
> by the way - in Config.in the help test for run-parts says you can
> exclude it - but if it's issued by ifup and ifdown, then won't that
> provoke errors?

Depends on whether you have third-party run-parts executable
in your system.

> config RUN_PARTS
>        bool "run-parts"
>        default y
>        help
>          run-parts is a utility designed to run all the scripts in a
>      directory.
>
>          It is useful to set up a directory like cron.daily, where you
>      need to execute all the scripts in that directory.
>
>          In this implementation of run-parts some features (such as report
>          mode) are not implemented.
>
>          Unless you know that run-parts is used in some of your scripts
>          you can safely say N here.


-- 
vda


More information about the busybox mailing list