http://www.c0t0d0s0.org/archives/7675-Less-known-Solaris-features-svccfg-editprop.html
Sometimes small features are really helpful. Nevertheless they are often relatively unknown. One of the examples is svccfg editprop
(it's in Solaris for quite a while know, but it got more comfortable by showing less information in the recent time, in earlier times the tool showed almost everything ... useful or not).
Let's assume you want to change the IP number of the DNS server. You could use the normal svccfg –s dns/client setprop config/nameserver = net_address: 192.168.1.1
command. However sometimes you don't know the correct property to change.
In my example the server starts with the following value for the name server property:
root@template:~# svcprop svc:/network/dns/client:default | grep "config/nameserver" config/nameserver net_address 192.168.1.2
Of course, with the information i used in this command it's faster to use the direct svccfg method shown before, however I just use it here to show you the effect of the following command.
Instead of using the command to change the property mentioned above, you can use svccfg -s svc:/network/dns/client:default editprop
. With this command you can change the properties of the SMF service /network/dns/client
. However you don't have to memorize the properties. The command shows it to you and gives you a mechanism to alter the properties. It fires up an vi
(or whatever you've configured your EDITOR
environment variable) and displays the following data in it.
## ## Change property values by removing the leading '#' from the ## appropriate lines and editing the values. svccfg subcommands ## such as delprop can also be added to the script. ## ## Property group "config" ## The following properties are defined in the selected instance ## (svc:/network/dns/client:default) ## ## The value used to construct the "nameserver" directive in resolv.conf(4). ## # setprop config/nameserver = net_address: 192.168.1.2 ## The following properties inherit from the parent service ## (svc:/network/dns/client) # setprop config/value_authorization = astring: solaris.smf.value.name-service.dns.client ## Uncomment to apply these changes to this instance. # refresh
When you want to to change some properties just remove the #
of the line you want to change, change the value of the property and remove the #
in front of the last line containing # refresh
.
The file should look like that (i'm omitting the lines with double-#).
setprop config/nameserver = net_address: 192.168.1.1 # setprop config/value_authorization = astring: solaris.smf.value.name-service.dns.client refresh
As soon as you savequit the editor, the SMF is updated and refreshed.
root@template:~# svcprop svc:/network/dns/client:default | grep "config/nameserver" config/nameserver net_address 192.168.1.1
setprop