Re: shell power in rc.conf

2009-08-20 Thread Mel Flynn
On Tuesday 18 August 2009 07:00:08 Dan Nelson wrote:
 In the last episode (Aug 18), Artis Caune said:
  Is there any reason of not using shell variables in rc.conf?
  I want to tune rc.conf for easy editing and administration. Take for
  example jail_list or cloned_interfaces with 10+ entries:

 Remember that every startup script sources rc.conf, sometimes very early or
 late in the startup/shutdown sequence, so just make sure you don't echo
 anything to stdout/stderr or try to run commands that might be on
 filesystems that aren't mounted yet, and you should be fine.

In this particular example, you're fine. In general, you should also take care 
that /etc/defaults/rc.conf is read before /etc/rc.conf and may set values for 
variables you have not specified. Defaults can also change between releases, 
so one should inspect /etc/defaults/rc.conf during mergemaster stage with a 
microscope.

-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


shell power in rc.conf

2009-08-18 Thread Artis Caune
Hi,

Is there any reason of not using shell variables in rc.conf?
I want to tune rc.conf for easy editing and administration. Take for
example jail_list or cloned_interfaces with 10+ entries:


# interfaces
cloned_interfaces=carp1 bce0.10 carp10 bce0.20 carp20

ifconfig_bce0_10=10.0.0.1/24
ifconfig_bce0_20=10.0.1.1/24
ifconfig_bce0_20_alias0=10.0.1.2/32
ifconfig_carp10=vhid 10 advskew 100 pass MySecret 10.0.0.100/32
ifconfig_carp20=vhid 20 advskew 15  pass MySecret 10.0.1.100/32

# jails
jail_list=ns mail

jail_ns_hostname=ns
jail_ns_ip=10.10.10.1

jail_mail_hostname=mail
jail_mail_ip=10.10.10.2


Instead I can rewrite this to:


# interfaces
cloned_interfaces=${cloned_interfaces} bce0.10
ifconfig_bce0_10=10.0.0.1/24

cloned_interfaces=${cloned_interfaces} bce0.20
ifconfig_bce0_20=10.0.1.1/24
ifconfig_bce0_20_alias0=10.0.1.2/32

cloned_interfaces=${cloned_interfaces} carp10
ifconfig_carp10=vhid 10 advskew 100 pass MySecret 10.0.0.100/32

cloned_interfaces=${cloned_interfaces} carp20
ifconfig_carp20=vhid 20 advskew 15  pass MySecret 10.0.1.100/32

# jails
jail_list=${jail_list} ns
jail_ns_hostname=ns
jail_ns_ip=10.10.10.1

jail_list=${jail_list} mail
jail_mail_hostname=mail
jail_mail_ip=10.10.10.2


Now I can just comment out unused interface or jail, and it won't start up.





-- 
Artis Caune

Everything should be made as simple as possible, but not simpler.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: shell power in rc.conf

2009-08-18 Thread Dan Nelson
In the last episode (Aug 18), Artis Caune said:
 Is there any reason of not using shell variables in rc.conf?
 I want to tune rc.conf for easy editing and administration. Take for
 example jail_list or cloned_interfaces with 10+ entries:

Remember that every startup script sources rc.conf, sometimes very early or
late in the startup/shutdown sequence, so just make sure you don't echo
anything to stdout/stderr or try to run commands that might be on
filesystems that aren't mounted yet, and you should be fine.

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org