[clug] Network "profiles" and locations

David Deaves David.Deaves at dd.id.au
Sun Aug 21 08:57:14 MDT 2011



/etc/NetworkManager/dispatcher.d/

allows you to put scripts to run there, I do most of my network re-config 
magic there, depending on the site I test $IP4_ADDRESS_0 and/or $DHCP4_DOMAIN_NAME
I also change my default printer.  You get passed in a swag of environment 
variables and arg1 is interface arg2 is up/down/dhcp4-change


If you want to avoid NetworkManager you could try putting a script in 
 /etc/dhcp/dhclient.d/  assuming your  /sbin/dhclient-script  calls files in 
there, if it does not then make it.


Because some of the changes I made I only wanted while at that site, and did 
not want to leave them in place even if I had not yet joined another network, 
I also put some clean-up into a script in  /usr/lib64/pm-utils/sleep.d/  that 
activated on suspend.


I works a treat for me, been doing it for ages now.
I started playing with each script by putting :

exec >>/tmp/20-Dave_Stuff 2>&1
echo
date
echo "$0 - $*"
env

at the front to see the full set of info passed in, however as the scripts in 
/etc/dhcp/dhclient.d are (.)ed that upset the rest of the running of /sbin/
dhclient-script, also to see all that is passed in I need to use 'set'



Dave !



More information about the linux mailing list