Index: trunk/ippScripts/scripts/ipp_cleanup.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_cleanup.pl	(revision 30626)
+++ trunk/ippScripts/scripts/ipp_cleanup.pl	(revision 30630)
@@ -1900,36 +1900,12 @@
 {
     my $files = shift; # reference to a list of files to unlink
-#     my $test_verbose = 1;
-
-#     if ($test_verbose == 1) {
-#       open(TMPLOG,">>/tmp/czw.cleanup.log");
-#       flock(TMPLOG,2);
-#     }
-
-    # this script is, of course, very dangerous.
+
     foreach my $file (@$files) {
         print STDERR "unlinking $stage $stage_id $file";
-        unless ($ipprc->file_exists($file)) {
-            print STDERR "\t File not found\n";
-        }
-        else {
-            print STDERR "\n";
-        }
-
-#       if ($test_verbose == 1) {
-#           print TMPLOG "$stage $stage_id $file";
-
-#           else {
-#               print TMPLOG "\n";
-#           }
-#       }
-
-        $ipprc->file_delete($file);
-    }
-
-#     if ($test_verbose == 1) {
-#       flock(TMPLOG,8);
-#       close(TMPLOG);
-#     }
+
+        my $error_code = $ipprc->kill_file($file);
+
+        &my_die("failed to kill $file", $stage, $stage_id, $PS_EXIT_CONFIG_ERROR) if $error_code;
+    }
 
     return 1;
Index: trunk/ippScripts/scripts/magic_destreak_cleanup.pl
===================================================================
--- trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30626)
+++ trunk/ippScripts/scripts/magic_destreak_cleanup.pl	(revision 30630)
@@ -44,5 +44,5 @@
            'magic_ds_id=s'  => \$magic_ds_id,# Magic destreak run identifier
            'camera=s'       => \$camera,     # camera for evaluating file rules
-           'stage=s'        => \$stage,     # camera for evaluating file rules
+           'stage=s'        => \$stage,      # ipp stage for this magicDSRun
            'save-temps'     => \$save_temps, # Save temporary files?
            'dbname=s'       => \$dbname,     # Database name
@@ -160,5 +160,5 @@
         my $backup_path_base = $comp->{backup_path_base};
         my ($bimage, $bmask, $bch_mask, $bweight, $bsources, $bastrom);
-        my ($rimage, $rmask, $rch_mask, $rweight, $rsources, $rastrom);
+#        my ($rimage, $rmask, $rch_mask, $rweight, $rsources, $rastrom);
 
         if ($stage eq "chip") {
@@ -219,5 +219,5 @@
         }
 
-        delete_files($bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask);
+        delete_files($bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask);
 
         if ($stage eq "diff" and $warp_warp) {
@@ -252,14 +252,6 @@
     foreach my $file (@_) {
         if ($file) {
-            if ($ipprc->file_exists($file)) {
-                if (!$no_update) {
-                    print STDERR "deleting $file\n" if $verbose;
-                    $ipprc->file_delete($file, 1) or my_die("Failed to delete $file", $magic_ds_id, $PS_EXIT_UNKNOWN_ERROR);
-                    } else {
-                    print STDERR "skipping delete $file\n";
-                }
-            } else {
-                print STDERR "$file not found\n" if $verbose;
-            }
+            my $error_code = $ipprc->kill_file($file);
+            my_die("Failed to delete $file", $magic_ds_id, $error_code) if $error_code;
         }
     }
