--- /dev/null
+#!/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
+# <host-name>/
+# 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 = <STDIN>;
+
+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";
+
+}
+