ifup and run-parts

David Collier from_busybox_maillist at dexdyne.com
Tue Jan 25 16:04:00 UTC 2011


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?

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

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?

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.



More information about the busybox mailing list