From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 6 23:53:44 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C24C01065670 for ; Wed, 6 Oct 2010 23:53:44 +0000 (UTC) (envelope-from dteske@vicor.com) Received: from postoffice.vicor.com (postoffice.vicor.com [69.26.56.53]) by mx1.freebsd.org (Postfix) with ESMTP id ABF038FC16 for ; Wed, 6 Oct 2010 23:53:44 +0000 (UTC) Received: from [208.206.78.30] (port=35510 helo=dt.vicor.com) by postoffice.vicor.com with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.71) (envelope-from ) id 1P3dng-00037R-1f; Wed, 06 Oct 2010 16:53:36 -0700 From: Devin Teske To: Brandon Gooch In-Reply-To: References: <1286397912.27308.40.camel@localhost.localdomain> Content-Type: text/plain Organization: Vicor, Inc Date: Wed, 06 Oct 2010 16:53:31 -0700 Message-Id: <1286409211.27308.48.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-41.el4) Content-Transfer-Encoding: 7bit X-Scan-Signature: 69a93e6f3710b3f43879ac8614e31bd1 X-Scan-Host: postoffice.vicor.com Cc: freebsd-hackers@freebsd.org Subject: Re: sysconf -- a sysctl(8)-like utility for managing /etc/rc.conf et. al. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2010 23:53:44 -0000 On Wed, 2010-10-06 at 18:09 -0500, Brandon Gooch wrote: > On Wed, Oct 6, 2010 at 3:45 PM, Devin Teske wrote: > > 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@mymachine ~ $ sysconf hostname > > hostname: mymachine.localdomain > > root@mymachine ~ $ sysconf hostname=foomaster.deluxe.com > > hostname: mymachine.localdomain -> foomaster.deluex.com > > root@mymachine ~ $ sysconf -e hostname > > hostname="foomaster.deluxe.com" > > root@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. > > It seems the list ate the attachment :( I'll post it as the body of the e-mail tomorrow (can't do it right now, just got a call from the wife -- the car broke down and I have to rush out to get her). > Also, take a look at sysconf(3). I think there may be a certain amount > of hesitation to welcome a utility with the same name as a > POSIX-compliant C library function... > > ...how about a name like 'sysrc' or 'rcconfig' or something indicating > a relationship with the rc.conf file or rc system? > > Anyway, sounds cool, as I've had a need recently to do some automated > configuring of several rc.conf files -- my method was very hackish, > and will never see the light of public scrutiny :) Thanks (to yourself and Garrett Cooper) for pointing out sysconf(3). I do agree with the possible confusion. I like the name suggestions. Let me throw out a couple more before sleeping on them tonight. rcctl (like sysctl but for rc stuffs) rcconf (pretty succinct -- too succinct?) sysrc was a great suggestion. > > -Brandon > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" -- 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@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 <-