- if (open(CLUSTERFILE, ">", $infile)) {
- print CLUSTERFILE $current_cluster;
- close(CLUSTERFILE);
- }
- else {
- printLogLn ($g_logfile, "ERROR: Can't open file $infile for writing");
+ unless (-f $infile && ($current_cluster eq $previous_cluster)) {
+ if ($g_debug) {
+ printLogLn($g_logfile, "DEBUG: Writing to status file");
+ }
+ if (open(CLUSTERFILE, ">", $infile)) {
+ print CLUSTERFILE $current_cluster;
+ close(CLUSTERFILE);
+ }
+ else {
+ printLogLn ($g_logfile, "ERROR: Can't open file $infile for writing");
+ }