Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Aug 2009 12:53:57 +0300
From:      Artis Caune <artis.caune@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   shell power in rc.conf
Message-ID:  <9e20d71e0908180253x4a11114cxc3e2c4af8798878@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9e20d71e0908180253x4a11114cxc3e2c4af8798878>