From 0dbabbe3186662d847c8a054743b40e44a73b1bd Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Tue, 17 Dec 2002 21:22:34 +0000 Subject: [PATCH] added program into CVS repository --- utils/convert-history | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 utils/convert-history diff --git a/utils/convert-history b/utils/convert-history new file mode 100755 index 0000000..b2f097d --- /dev/null +++ b/utils/convert-history @@ -0,0 +1,41 @@ +#!/usr/bin/perl -w +# +# convert-history - Convert Spong history archive to new format +# +# This program converts the old Spong history archive to the new archive format +# which will include the event data files in addition to the history files +# The new format will be the same as the current database format +# / +# history -> history file +# status/ -> status data for events +# +# $Id: convert-history,v 1.1 2002/12/17 21:22:34 sljohnson Exp $ + +use strict; # strict compiler +$|++; # disable buffering for stdin + +print "This utility will convert the Spong History files into the new format/\n"; +print "This utility should be run as the spong user in order to maintain "; +print "proper ownerships.\n"; +print "\nPress enter to proceeded\n"; +my $t = ; + +my $SPONG_ARCHIVE = "/usr/local/spong/var/archives"; + +opendir(DIR,$SPONG_ARCHIVE) || die "Could not opendir $SPONG_ARCHIVE: $!"; +chdir $SPONG_ARCHIVE; + +while ( my $file = readdir(DIR) ) { + if ( ! -f "$SPONG_ARCHIVE/$file" ) { + print "History file for host $file not found, skipping"; + next; + } + + print "Converting host $file\n"; + rename $file, $file . ".tmp"; + mkdir $file,"0777"; + mkdir "$file/status","0777"; + rename $file . ".tmp", "$file/history"; + +} + -- 2.30.2