sysconf -- a sysctl(8)-like utility for managing /etc/rc.conf et.
al.
Devin Teske
dteske at vicor.com
Wed Oct 6 21:21:41 UTC 2010
Hello fellow freebsd-hackers,
Long-time hacker, first-time poster.
I'd like to share a shell script that I wrote for FreeBSD system
administration.
The attached shell script works similar to sysctl(8), but rather than
querying or working on sysctl MIBs, it instead works on the /etc/rc.conf
(and /etc/rc.conf.local) files.
Syntax shown below (available by running the script without arguments):
Usage: sysconf [OPTIONS] name[=value] ...
OPTIONS:
-h --help Print this message to stderr and exit.
-d Print list of internal dependencies before exit.
-e Print query results as `var=value' (useful for producing
output to be fed back in). Ignored if -n is specified.
-n Show only variable values, not their names.
ENVIRONMENT:
SYSCONF_SHOW_DEPS Dump list of dependencies. Must be zero or one
(default: `0')
RC_DEFAULTS Location of `/etc/defaults/rc.conf' file.
Examples:
root at mymachine ~ $ sysconf hostname
hostname: mymachine.localdomain
root at mymachine ~ $ sysconf hostname=foomaster.deluxe.com
hostname: mymachine.localdomain -> foomaster.deluex.com
root at mymachine ~ $ sysconf -e hostname
hostname="foomaster.deluxe.com"
root at mymachine ~ $ sysconf -n hostname
foomaster.deluxe.com
The script has zero external dependencies. None. Period. It will use
grep(1) if installed, but it is not required.
Tested extensively on FreeBSD-4.8, FreeBSD-4.11, FreeBSD-8.0, and
FreeBSD-8.1.
--
Cheers,
Devin Teske
-> CONTACT INFORMATION <-
Business Solutions Consultant II
FIS - fisglobal.com
510-735-5650 Mobile
510-621-2038 Office
510-621-2020 Office Fax
909-477-4578 Home/Fax
devin.teske at fisglobal.com
-> LEGAL DISCLAIMER <-
This message contains confidential and proprietary information
of the sender, and is intended only for the person(s) to whom it
is addressed. Any use, distribution, copying or disclosure by any
other person is strictly prohibited. If you have received this
message in error, please notify the e-mail sender immediately,
and delete the original message without making a copy.
-> FUN STUFF <-
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GAT/CS d(+) s: a- C++(++++) UB++++$ P++(++++) L++(++++) !E--- W++ N? o? K- w O
M+ V- PS+ PE Y+ PGP- t(+) 5? X+(++) R>++ tv(+) b+(++) DI+(++) D(+) G+>++ e>+ h
r>++ y+
------END GEEK CODE BLOCK------
http://www.geekcode.com/
-> END TRANSMISSION <-
More information about the freebsd-hackers
mailing list