PIKT Logo PIKT

Tutorial: Some Configuration Management

PIKT Tip Jar
PIKT is user-supported software. 
Please show your support.
 
Home
News
Introduction
Samples
Tutorial
Reference
Software
Authors
Licensing



Forum
Marketplace
Links
SiteSearch
FAQ
Contribute
Donate
ContactUs



Google
Web pikt.org


Some Configuration Management

Let's do a little configuration management.  Create a new file, /pikt/lib/configs/files.cfg, and give it the content:

	/////////////////////////////////////////////////////////////////////////////
	//
	// PIKT files.cfg
	//
	/////////////////////////////////////////////////////////////////////////////

	motd            path "/etc/motd" mode 644 uid 0 gid 0

	// a standard blurb

	        To read this message in full, use the command:  more /etc/motd
	        To suppress display of this message, use the command:
                touch ~/.hushlogin

	/////////////////////////////////////////////////////////////////////////////
	
Note:  The whitespace before each "To ..." should be exactly one tab.  The preprocessor trims the first whitespace and applies the rest of the line exactly as written, so if a line in files.cfg begins with 8 spaces, 7 spaces will begin each line in the target file, which is probably not what you want.

Before installing your PIKT-managed motd file, diff it against any existing motd file:

	/pikt/bin/piktc -fv +F motd +H mysystem

	processing mysystem...
	fetching file(s)...
	motd fetched
	diffing file(s)...
	diff -r /pikt/lib/configs/staging/etc/motd /pikt/lib/configs/diffing/etc/motd
	1,2c1
	< To read this message in full, use the command:  more /etc/motd
	< To suppress display of this message, use the command:  touch ~/.hushlogin
	---
	> Sun Microsystems Inc. SunOS 5.8       Generic April 2001
	
Oh, we have a difference!  Let's add what we're missing to our files.cfg:
	/////////////////////////////////////////////////////////////////////////////

	motd            path "/etc/motd" mode 644 uid 0 gid 0

	// a standard blurb

	        Sun Microsystems Inc. SunOS 5.8       Generic April 2001

	        To read this message in full, use the command:  more /etc/motd
	        To suppress display of this message, use the command:
                touch ~/.hushlogin

	/////////////////////////////////////////////////////////////////////////////
	
(It goes without saying that you should add whatever is appropriate to your own situation.)

Note: The second line above (the one after the "Sun Microsystems...") is a single tab (then end-of-line).  When installed, this will create a blank line at that position.

Redo the diff:

	/pikt/bin/piktc -fv +F motd +H mysystem

	processing mysystem...
	fetching file(s)...
	motd fetched
	diffing file(s)...
	diff -r /pikt/lib/configs/staging/etc/motd /pikt/lib/configs/diffing/etc/motd
	2,4c1
	< 
	< To read this message in full, use the command:  more /etc/motd
	< To suppress display of this message, use the command:  touch ~/.hushlogin
	---
	
Good enough.

When incorporating system configuration files into your PIKT configuration, your goal should initially be to match exactly what's on disk, so your 'piktc -f' commands should initially report no diffs.  Only after you are certain you've captured your configuration file(s) exactly should you begin applying significant changes in the files.cfg.

Finally, install your motd with the command

	/pikt/bin/piktc -iv +F motd +H mysystem

	processing mysystem...
	installing file(s)...
	motd installed
	
Check that the ownerships and permissions are as specified:
	ls -l /etc/motd
	-rw-r--r--   1 root     root          198 Sep 26 18:13 /etc/motd
	
And verify directly the contents of the motd file:
	cat /etc/motd
	Sun Microsystems Inc. SunOS 5.8       Generic April 2001

	To read this message in full, use the command:  more /etc/motd
	To suppress display of this message, use the command:  touch ~/.hushlogin
	
Before we leave this topic, let's see a listing of all PIKT pieces we've put in place so far:
	/pikt/bin/piktc -lv +A all +F all +H mysystem

	processing mysystem...
	listing file(s)...
	Critical.alt found
	Debug.alt found
	listing file(s)...
	motd found
	
This is a rather trivial example, but it demonstrates the general technique.  Later, you will probably want to begin managing other system configuration files, for example inetd.conf, syslog.conf, and others, from the central PIKT configuration.

Before you move on to the concluding section of the Tutorial, remember to kill the piktd and piktc_svc daemons using the following commands:

	/pikt/bin/piktc -k +H mysystem
	/pikt/bin/piktc -K +H mysystem
	


Home | News | Introduction | Samples | Tutorial | Reference | Software | Authors | Licensing
Forum | Marketplace | Links | SiteSearch | FAQ | Contribute | Donate | ContactUs
Top of Page

Join pikt-users, pikt-workers, and/or the PIKT Forum. 
Open Hand Please visit our sponsors.

Page best viewed at 1024x768.   Page last updated 2005-01-07.
This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.
Copyright © 1998-2005 Robert Osterlund.  All rights reserved.