Hello all, many thanks for the responses. I think I'll probably try and bring some automation to what we are doing at the moment - ie check for changed application files/directories and then sync them up. But its still early days and long term we really need to move our applications out of root and into their own zfs filesystems. Anyway, here's the summary; Crist Clark suggested using a catch-all synclist but pointed out a gotcha; === As an aside, something to really watch out for when using custom synclists. Last time I did a patch cluster using LU, the patches overwrote my custom synclist file on the upgraded BE. So when I then booted in to the new BE, the synclist had gone back to the Solaris default. === Karl Vogel sent the following suggestion and script; === I'm not sure if it's better, but I may be able to help you automate some of the grunt-work. When I install a system, the first thing I do is get a table of contents: root# mkdir -p /root/toc root# cd /root/toc root# find / /usr /var /opt -xdev -type f -print | xargs /opt/sfw/bin/md5sum > orig.md5 After the system is ready to go, I create a new TOC cleverly named "new.md5". I've enclosed a shar file with a script that compares TOC files and prints what's been added, changed, or deleted. Maybe you can adapt this approach for your system. --------------------------------------------------------------------------- #!/bin/sh # This is a shell archive (produced by GNU sharutils 4.6). # To extract the files from this archive, save it to some FILE, remove # everything before the `!/bin/sh' line above, then type `sh FILE'. # # Made on 2010-01-22 22:04 EST by <vogelke@home>. # Source directory was `/home/vogelke/notebook/2010/0123/upgrade'. # # Existing files will *not* be overwritten unless `-c' is specified. # This format requires very little intelligence at unshar time. # "if test", "echo", "mkdir", and "sed" may be needed. # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 9630 -rwxr-xr-x acd # echo=echo shar_tty= shar_n= shar_c=' ' mkdir _sh19239 || ( echo 'failed to create locking directory' '_sh19239'; exit 1 ) # ============= acd ============== if test -f 'acd' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'acd' '(file already exists)' else $echo 'x -' extracting 'acd' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'acd' && X#!/usr/bin/perl -w X#<acd: show added, changed, or deleted files based on signatures X Xmy $rcsid = '$Id: acd,v 1.5 2009/07/20 18:11:54 vogelke Exp $'; Xmy $rcssrc = '$Source: /src/opt/acd/RCS/acd,v $'; X Xuse Getopt::Long; Xuse Pod::Usage; Xuse File::Basename; Xuse strict; X X$ENV{'PATH'} = join ":", qw(/bin /usr/bin /usr/local/bin /opt/sfw/bin); X Xmy $myname = basename($0); X$myname =~ s/\.\w*$//; # strip any extension X Xmy %options; X$options{'a'} = $options{'c'} = $options{'d'} = $options{'s'} = 0; X Xmy @getopt_args = ( X 'a', # show added files X 'c', # show changed files X 'd', # show deleted files X 'h|?', # print usage X 'm', # print manpage X 's', # show identical (same) files X 'u', # print UUID X 'v', # print version X 'w', # print source location X ); X XGetopt::Long::config("noignorecase", "bundling"); Xusage() unless GetOptions(\%options, @getopt_args); X Xmanpage() if $options{'m'}; Xmyuuid() if $options{'u'}; Xversion() if $options{'v'}; Xwhere() if $options{'w'}; Xusage() if $options{'h'}; X X# X# If none of -[acds] have been specified, turn "acd" on. X# I'm not usually concerned with files that haven't changed. X# X Xunless ($options{'a'} + $options{'c'} + $options{'d'} + $options{'s'}) { X $options{'a'} = $options{'c'} = $options{'d'} = 1; X} X Xmy $osum = $options{'a'} + $options{'c'} + $options{'d'} + $options{'s'}; X X# X# Store old and new signature files. X# X Xmy $ofile = shift @ARGV or usage("I need an old signature file"); Xmy %old = storesig($ofile); X Xmy $nfile = shift @ARGV or usage("I need a new signature file"); Xmy %new = storesig($nfile); X X# X# Deleted files will only be in the existing system, %old. X# X Xif ($options{'d'}) { X X # Skip the leading letter if only one option is present. X my $code = ($osum == 1) ? '' : 'D '; X X foreach (sort keys %old) { X print $code, "$_\n" unless exists $new{$_}; X } X} X X# X# Added files will only be in the system we've just installed, %new. X# Changed files will be in %old and %new, but with differing signatures. X# X Xif ($options{'a'} || $options{'c'} || $options{'s'}) { X my ($code, $cdiff, $cadd, $csame); X X if ($options{'a'}) { $cadd = ($osum == 1) ? '' : 'A '; } X if ($options{'c'}) { $cdiff = ($osum == 1) ? '' : 'C '; } X if ($options{'s'}) { $csame = ($osum == 1) ? '' : 'S '; } X X foreach (sort keys %new) { X $code = $cadd; X X if (exists $old{$_}) { X if ($new{$_} eq $old{$_}) { X $code = $csame; X } X else { X $code = $cdiff; X } X } X X print $code, "$_\n" if defined $code; X } X} X Xexit(0); X X#--------------------------------------------------------------------- Xsub storesig { X my $path = shift || die "storesig: need a file\n"; X my ($f, $md5, %result); X X open(my $fh, "< $path") or die "$path: can't read: $!\n"; X while (<$fh>) { X chomp; X ($md5, $f) = split(/\s/, $_, 2); # EXACTLY two fields X $result{$f} = $md5; X } X close($fh); X return (%result); X} X X#--------------------------------------------------------------------- X# Print a usage message and exit. X Xsub usage { X my ($emsg) = @_; X X use Pod::Usage qw(pod2usage); X warn "$emsg\n\n" if defined $emsg; X pod2usage(-verbose => 99, -sections => "NAME|SYNOPSIS|OPTIONS"); X} X Xsub manpage { X use Pod::Man(); X X my $parser = Pod::Man->new(); X open(STDOUT, "| groff -T ascii -man | gcat -s | less") || die "groff\n"; X $parser->parse_from_file($0); X X close STDOUT || die "$myname: can't close stdout: $!\n"; X $? = 1 if $? == 255; # from die X exit($?); X} X X#--------------------------------------------------------------------- X# Print the UUID, current version, or source location. X Xsub myuuid { X my $UUID = sprintf("%s", X q$UUID: bc8f3b41-faa7-395c-bd52-585452bab009 $ =~ /UUID: (.*) /); X print "$UUID\n"; X exit(0); X} X Xsub version { X my $VERSION = sprintf("%d.%02d", q$Revision: 1.5 $ =~ /(\d+)\.(\d+)/); X my $DATE = X sprintf("%s", q$Date: 2009/07/20 18:11:54 $ =~ /Date: (.*) /); X print "$myname $VERSION $DATE\n"; X exit(0); X} X Xsub where { X my $SOURCE = sprintf("%s", X q$Source: /src/opt/acd/RCS/acd,v $ =~ /Source: (.*) /); X print "$SOURCE\n"; X exit(0); X} X X#--------------------------------------------------------------------- X__END__ X X=head1 NAME X Xacd - show added, changed, or deleted files based on signatures X X=head1 SYNOPSIS X Xacd [-acdhmusvw] old new X X=head1 OPTIONS X X=over 4 X X=item B<-a> X XShow only added files. X X=item B<-c> X XShow only changed files. X X=item B<-d> X XShow only deleted files. X X=item B<-h> X XPrint a brief help message and exit. X X=item B<-m> X XPrint the manual page and exit. X X=item B<-s> X XShow only identical files. X X=item B<-u> X XPrint the script UUID and exit. X X=item B<-v> X XPrint the version and exit. X X=item B<-w> X XPrint the source location and exit. X X=back X X=head1 DESCRIPTION X XB<acd> reads old and new signature files, which should be the Xoutput from "md5sum" or "md5 -r", and prints a list showing which Xfiles were added, changed, or deleted. X XActually, any method of hashing a file will do, as long as it prints Xoutput in the form "signature filename". X X=head1 EXAMPLE X XB<sig.old> is a signature file for a system that's been around for Xawhile. It's had lots of files added, deleted, tweaked, etc. The Xsignatures are just 4-digit numbers for illustration: X XB< me% cat sig.old> X 1111 /.cshrc X 1111 /.profile X 1111 /COPYRIGHT X 1111 /bin/[ X 1111 /bin/cat X 1111 /bin/chflags X 1111 /bin/chio X 1111 /bin/chmod X 1111 /bin/cp X 1111 /bin/csh X 1111 /var/run/dmesg.boot X 2222 /var/run/ld-elf.so.hints X 3333 /var/run/ld.so.hints X 1111 /var/run/sendmail.pid X 2222 /var/run/sshd.pid X 3333 /var/run/syslog.pid X 1111 /var/run/syslogd.sockets X 2222 /var/run/utmp X 3333 /var/spool/clientmqueue/sm-client.pid X 4444 /var/yp/Makefile.dist X XB<sig.new> is a signature file for a brand-new system: X XB< me% cat sig.new> X 1111 /.cshrc X 2222 /.profile X 1111 /COPYRIGHT X 1111 /bin/[ X 1111 /bin/cat X 1111 /bin/chflags X 1111 /bin/chio X 1111 /bin/chmod X 1111 /bin/cp X 1111 /bin/csh X 1111 /usr/src/usr.sbin/zic/tz-link.htm X 1111 /usr/src/usr.sbin/zic/zdump.8 X 2222 /usr/src/usr.sbin/zic/zdump.c X 2222 /usr/src/usr.sbin/zic/zdump/Makefile X 2222 /usr/src/usr.sbin/zic/zic.8 X 3333 /usr/src/usr.sbin/zic/zic.c X 3333 /usr/src/usr.sbin/zic/zic/Makefile X 4444 /usr/src/usr.sbin/zzz/Makefile X 4444 /usr/src/usr.sbin/zzz/zzz.8 X 4444 /usr/src/usr.sbin/zzz/zzz.sh X XThe existing system has run-time files like "sshd.pid" that aren't on Xthe new system, but the new system has additional files, like some of the Xsystem source files under /usr/src. We've also changed root's .profile: X XB< me% acd sig.old sig.new> X D /var/run/dmesg.boot X D /var/run/ld-elf.so.hints X D /var/run/ld.so.hints X D /var/run/sendmail.pid X D /var/run/sshd.pid X D /var/run/syslog.pid X D /var/run/syslogd.sockets X D /var/run/utmp X D /var/spool/clientmqueue/sm-client.pid X D /var/yp/Makefile.dist X C /.profile X A /usr/src/usr.sbin/zic/tz-link.htm X A /usr/src/usr.sbin/zic/zdump.8 X A /usr/src/usr.sbin/zic/zdump.c X A /usr/src/usr.sbin/zic/zdump/Makefile X A /usr/src/usr.sbin/zic/zic.8 X A /usr/src/usr.sbin/zic/zic.c X A /usr/src/usr.sbin/zic/zic/Makefile X A /usr/src/usr.sbin/zzz/Makefile X A /usr/src/usr.sbin/zzz/zzz.8 X A /usr/src/usr.sbin/zzz/zzz.sh X XJust the files on the new system that aren't on the old one: X XB< me% acd -a sig.old sig.new> X /usr/src/usr.sbin/zic/tz-link.htm X /usr/src/usr.sbin/zic/zdump.8 X /usr/src/usr.sbin/zic/zdump.c X /usr/src/usr.sbin/zic/zdump/Makefile X /usr/src/usr.sbin/zic/zic.8 X /usr/src/usr.sbin/zic/zic.c X /usr/src/usr.sbin/zic/zic/Makefile X /usr/src/usr.sbin/zzz/Makefile X /usr/src/usr.sbin/zzz/zzz.8 X /usr/src/usr.sbin/zzz/zzz.sh X XJust the changed files: X XB< me% acd -c sig.old sig.new> X /.profile X XJust the files on the old system that we've deleted: X XB< me% acd -d sig.old sig.new> X /var/run/dmesg.boot X /var/run/ld-elf.so.hints X /var/run/ld.so.hints X /var/run/sendmail.pid X /var/run/sshd.pid X /var/run/syslog.pid X /var/run/syslogd.sockets X /var/run/utmp X /var/spool/clientmqueue/sm-client.pid X /var/yp/Makefile.dist X XIdentical files: X XB< me% acd -s sig.old sig.new> X /.cshrc X /COPYRIGHT X /bin/[ X /bin/cat X /bin/chflags X /bin/chio X /bin/chmod X /bin/cp X /bin/csh X XAdded and changed files: X XB< me% acd -ac sig.old sig.new> X C /.profile X A /usr/src/usr.sbin/zic/tz-link.htm X A /usr/src/usr.sbin/zic/zdump.8 X A /usr/src/usr.sbin/zic/zdump.c X A /usr/src/usr.sbin/zic/zdump/Makefile X A /usr/src/usr.sbin/zic/zic.8 X A /usr/src/usr.sbin/zic/zic.c X A /usr/src/usr.sbin/zic/zic/Makefile X A /usr/src/usr.sbin/zzz/Makefile X A /usr/src/usr.sbin/zzz/zzz.8 X A /usr/src/usr.sbin/zzz/zzz.sh X XEverything, including identical files: X XB< me% acd -acds sig.old sig.new> X D /var/run/dmesg.boot X D /var/run/ld-elf.so.hints X D /var/run/ld.so.hints X D /var/run/sendmail.pid X D /var/run/sshd.pid X D /var/run/syslog.pid X D /var/run/syslogd.sockets X D /var/run/utmp X D /var/spool/clientmqueue/sm-client.pid X D /var/yp/Makefile.dist X S /.cshrc X C /.profile X S /COPYRIGHT X S /bin/[ X S /bin/cat X S /bin/chflags X S /bin/chio X S /bin/chmod X S /bin/cp X S /bin/csh X A /usr/src/usr.sbin/zic/tz-link.htm X A /usr/src/usr.sbin/zic/zdump.8 X A /usr/src/usr.sbin/zic/zdump.c X A /usr/src/usr.sbin/zic/zdump/Makefile X A /usr/src/usr.sbin/zic/zic.8 X A /usr/src/usr.sbin/zic/zic.c X A /usr/src/usr.sbin/zic/zic/Makefile X A /usr/src/usr.sbin/zzz/Makefile X A /usr/src/usr.sbin/zzz/zzz.8 X A /usr/src/usr.sbin/zzz/zzz.sh X X=head1 AUTHOR X X Karl Vogel <vogelke@pobox.com> X Sumaria Systems, Inc. X X=cut SHAR_EOF : || $echo 'restore of' 'acd' 'failed' fi $echo $shar_n 'x -' 'lock directory' "\`_sh19239': " $shar_c if rm -fr _sh19239; then $echo 'removed' else $echo 'failed to remove' fi exit 0 _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Sat Jan 23 09:46:10 2010
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:15 EST