Index: /trunk/ippScripts/scripts/background_warp.pl
===================================================================
--- /trunk/ippScripts/scripts/background_warp.pl	(revision 34591)
+++ /trunk/ippScripts/scripts/background_warp.pl	(revision 34592)
@@ -88,5 +88,5 @@
 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR );
 
-$ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect;
+$ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect;
 
 # Recipes to use based on reduction class
@@ -158,11 +158,18 @@
 &my_die("Can't find input astrometry: $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($astrometry);
 
-my $out_image = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id );
-my $out_mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id);
-my $out_stats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id );
-my $out_config = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id);
-my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
-
-my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id );
+#my $out_image = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id );
+#my $out_mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id);
+#my $out_stats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id );
+#my $out_config = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id);
+#my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
+
+my $out_image = prepare_output("PSWARP.OUTPUT", $outroot, $skycell_id,  1);
+my $out_mask = prepare_output("PSWARP.OUTPUT.MASK", $outroot, $skycell_id, 1);
+my $out_stats = prepare_output("SKYCELL.STATS", $outroot, $skycell_id, 1);
+my $out_config = prepare_output("PSWARP.CONFIG", $outroot, $skycell_id, 1);
+my $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1);
+
+my $skyFile = prepare_output("SKYCELL.TEMPLATE", $outroot, $skycell_id, 1);
+
 $ipprc->skycell_file( $tess_dir, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR);
 
@@ -239,4 +246,18 @@
 ### Pau.
 
+sub prepare_output
+{
+    my $filerule = shift;
+    my $outroot  = shift;
+    my $skycell_id = shift;
+    my $delete = shift;
+    $delete = 0 if !defined $delete;
+
+    my $error;
+    my $output = $ipprc->prepare_output($filerule, $outroot, $skycell_id, $delete, \$error)
+                    or &my_die("failed to prepare output file for: $filerule", $warp_bg_id, $skycell_id, $error);
+    return $output;
+}
+
 
 sub my_die
