Index: /branches/eam_branch_20080706/ippScripts/scripts/camera_exp.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/camera_exp.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/camera_exp.pl	(revision 18473)
@@ -27,19 +27,20 @@
 
 my ( $exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $verbose, $no_update,
-     $no_op, $save_temps );
+     $no_op, $redirect, $save_temps );
 GetOptions(
-           'exp_tag=s'          => \$exp_tag, # Exposure identifier
-           'cam_id=s'          => \$cam_id, # Camtool identifier
-           'recipe=s'          => \$recipe, # Recipe to use
-           'camera|c=s'        => \$camera, # Camera
-           'dbname|d=s'        => \$dbname, # Database name
-           'outroot|w=s'       => \$outroot, # output file base name
-           'reduction=s'       => \$reduction, # Reduction class
-           'dvodb|w=s'         => \$dvodb,  # output DVO database
-           'verbose'           => \$verbose,   # Print to stdout
-           'no-update'         => \$no_update, # Update the database?
-           'no-op'             => \$no_op, # Don't do any operations?
-           'save-temps'        => \$save_temps, # Save temporary files?
-           ) or pod2usage( 2 );
+    'exp_tag=s'          => \$exp_tag, # Exposure identifier
+    'cam_id=s'          => \$cam_id, # Camtool identifier
+    'recipe=s'          => \$recipe, # Recipe to use
+    'camera|c=s'        => \$camera, # Camera
+    'dbname|d=s'        => \$dbname, # Database name
+    'outroot|w=s'       => \$outroot, # output file base name
+    'reduction=s'       => \$reduction, # Reduction class
+    'dvodb|w=s'         => \$dvodb,  # output DVO database
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update, # Update the database?
+    'no-op'             => \$no_op, # Don't do any operations?
+    'redirect-output'   => \$redirect,
+    'save-temps'        => \$save_temps, # Save temporary files?
+    ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -54,4 +55,8 @@
 
 $ipprc->define_camera($camera);
+
+my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+
+$ipprc->redirect_output($logDest) if $redirect;
 
 # Recipes to use based on reduction class
@@ -185,5 +190,4 @@
 my $fpaStats   = $ipprc->filename("PSASTRO.STATS",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
 my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
-my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
 
 # convert supplied DVO database name to UNIX filename
Index: /branches/eam_branch_20080706/ippScripts/scripts/chip_imfile.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/chip_imfile.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/chip_imfile.pl	(revision 18473)
@@ -26,18 +26,19 @@
 # Parse the command-line arguments
 my ( $exp_id, $chip_id, $class_id, $uri, $camera, $outroot, $dbname, $reduction, $verbose,
-     $no_update, $no_op );
+     $no_update, $no_op, $redirect );
 GetOptions(
-           'exp_id=s'      => \$exp_id,    # Exposure identifier
-           'chip_id=s'     => \$chip_id,   # Chiptool identifier
-           'class_id=s'    => \$class_id,  # Class identifier
-           'uri|u=s'       => \$uri,       # Input FITS file
-           'camera|c=s'    => \$camera,    # Camera
-           'outroot|w=s'   => \$outroot,   # output file base name
-           'dbname|d=s'    => \$dbname,    # Database name
-           'reduction=s'   => \$reduction, # Reduction class
-           'verbose'       => \$verbose,   # Print to stdout
-           'no-update'     => \$no_update, # Don't update the database?
-           'no-op'         => \$no_op,     # Don't do any operations?
-           ) or pod2usage( 2 );
+    'exp_id=s'      	=> \$exp_id,    # Exposure identifier
+    'chip_id=s'     	=> \$chip_id,   # Chiptool identifier
+    'class_id=s'    	=> \$class_id,  # Class identifier
+    'uri|u=s'       	=> \$uri,       # Input FITS file
+    'camera|c=s'    	=> \$camera,    # Camera
+    'outroot|w=s'   	=> \$outroot,   # output file base name
+    'dbname|d=s'    	=> \$dbname,    # Database name
+    'reduction=s'   	=> \$reduction, # Reduction class
+    'verbose'       	=> \$verbose,   # Print to stdout
+    'no-update'     	=> \$no_update, # Don't update the database?
+    'no-op'         	=> \$no_op,     # Don't do any operations?
+    'redirect-output'   => \$redirect,
+    ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -52,4 +53,8 @@
 
 $ipprc->define_camera($camera);
+
+my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+
+$ipprc->redirect_output($logDest) if $redirect;
 
 # Recipes to use based on reduction class
@@ -125,5 +130,4 @@
 my $outputStats   = $ipprc->filename("PPIMAGE.STATS",       $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 my $traceDest     = $ipprc->filename("TRACE.IMFILE",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $logDest       = $ipprc->filename("LOG.IMFILE",          $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # Run ppImage
Index: /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_calc.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_calc.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_calc.pl	(revision 18473)
@@ -20,19 +20,22 @@
 use PS::IPP::Config 1.01 qw( :standard );
 
+my $ipprc = PS::IPP::Config->new(); # IPP configuration
+
 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
 use Pod::Usage qw( pod2usage );
 
 # Parse command-line arguments
-my ($det_id, $iter, $detType, $outroot, $dbname, $verbose, $no_update, $no_op);
+my ($det_id, $iter, $detType, $outroot, $dbname, $verbose, $no_update, $no_op, $redirect );
 GetOptions(
-	'det_id|d=s'	=> \$det_id,    # Detrend id			     
-	'iteration|i=s'	=> \$iter,	# Iteration			     
-	'det_type|t=s'  => \$detType,	# Detrend type			     
-        'outroot|w=s'   => \$outroot,   # output file base name
- 	'dbname|d=s'    => \$dbname,	# Database name			     
-        'verbose'       => \$verbose,   # Print to stdout
-        'no-update'     => \$no_update,	# Don't update the database?	     
-	'no-op'         => \$no_op,	# Don't do operations                
-	) or pod2usage( 2 );
+    'det_id|d=s'	=> \$det_id,    # Detrend id			     
+    'iteration|i=s'	=> \$iter,	# Iteration			     
+    'det_type|t=s'  	=> \$detType,	# Detrend type			     
+    'outroot|w=s'   	=> \$outroot,   # output file base name
+    'dbname|d=s'    	=> \$dbname,	# Database name			     
+    'verbose'       	=> \$verbose,   # Print to stdout
+    'no-update'     	=> \$no_update,	# Don't update the database?	     
+    'no-op'         	=> \$no_op,	# Don't do operations                
+    'redirect-output'   => \$redirect,
+    ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -44,4 +47,8 @@
     defined $detType and
     defined $outroot;
+
+my $logfile = $outroot . ".log";
+
+$ipprc->redirect_output($logfile) if $redirect;
 
 use constant STATISTIC => 'bg'; # Background statistic to use from the database
Index: /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_exp.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_exp.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/detrend_norm_exp.pl	(revision 18473)
@@ -26,18 +26,19 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $no_update, $no_op, $save_temps);
+my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $verbose, $no_update, $no_op, $redirect, $save_temps);
 GetOptions(
-           'det_id|d=s'        => \$det_id,
-           'iteration|i=s'     => \$iter,
-           'camera|c=s'        => \$camera,
-           'det_type|t=s'      => \$det_type,
-           'outroot|w=s'       => \$outroot,   # output file base name
-           'dbname|d=s'        => \$dbname, # Database name
-           'reduction|=s'      => \$reduction,
-           'verbose'           => \$verbose,   # Print to stdout
-           'no-update'         => \$no_update,
-           'no-op'             => \$no_op,
-           'save-temps'        => \$save_temps, # Save temporary files?
-           ) or pod2usage( 2 );
+    'det_id|d=s'        => \$det_id,
+    'iteration|i=s'     => \$iter,
+    'camera|c=s'        => \$camera,
+    'det_type|t=s'      => \$det_type,
+    'outroot|w=s'       => \$outroot,   # output file base name
+    'dbname|d=s'        => \$dbname, # Database name
+    'reduction|=s'      => \$reduction,
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update,
+    'no-op'             => \$no_op,
+    'redirect-output'   => \$redirect,
+    'save-temps'        => \$save_temps, # Save temporary files?
+    ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -49,4 +50,8 @@
     defined $det_type and
     defined $outroot;
+
+my $logfile = $outroot . ".log";
+
+$ipprc->redirect_output($logfile) if $redirect;
 
 $ipprc->define_camera($camera);
Index: /branches/eam_branch_20080706/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/detrend_process_imfile.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/detrend_process_imfile.pl	(revision 18473)
@@ -58,6 +58,5 @@
 $ipprc->define_camera($camera);
 
-my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id)
-      or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 $ipprc->redirect_output($logDest) if $redirect;
Index: /branches/eam_branch_20080706/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/detrend_reject_exp.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/detrend_reject_exp.pl	(revision 18473)
@@ -28,16 +28,17 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type, $camera, $outroot, $filter, $dbname, $verbose, $no_update, $no_op);
+my ($det_id, $iter, $det_type, $camera, $outroot, $filter, $dbname, $verbose, $no_update, $no_op, $redirect);
 GetOptions(
-           'det_id|d=s'        => \$det_id,
-           'iteration=s'       => \$iter,
-           'det_type|t=s'      => \$det_type,
-           'camera=s'          => \$camera,
-           'outroot|w=s'       => \$outroot,   # output file base name
-           'filter=s'          => \$filter,
-           'dbname|d=s'        => \$dbname, # Database name
-           'verbose'           => \$verbose,   # Print to stdout
-           'no-update'         => \$no_update,
-           'no-op'             => \$no_op,
+    'det_id|d=s'        => \$det_id,
+    'iteration=s'       => \$iter,
+    'det_type|t=s'      => \$det_type,
+    'camera=s'          => \$camera,
+    'outroot|w=s'       => \$outroot,   # output file base name
+    'filter=s'          => \$filter,
+    'dbname|d=s'        => \$dbname, # Database name
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update,
+    'no-op'             => \$no_op,
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
@@ -50,4 +51,11 @@
     defined $camera   and
     defined $outroot;
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $logName = "$outroot.log"; # Name for log
+
+$ipprc->redirect_output($logName) if $redirect;
 
 # values to extract from output metadata and the stats to calculate
@@ -145,9 +153,4 @@
 # neb:///*/gpc1/20080130 (volume not specified)
 
-# check for existing directory, generate if needed
-$ipprc->outroot_prepare($outroot);
-
-my $logName = "$outroot.log"; # Name for log
-
 my $logFile;
 unless ($no_op) {
@@ -302,4 +305,10 @@
     exit($PS_EXIT_PROG_ERROR);
 }
+
+# Allow iteration to be turned off
+my $allow_iter = metadataLookupBool($ipprc->{rejection}, "ITERATION"); # Allow iteration?
+my $force_master = metadataLookupBool($ipprc->{rejection}, "MASTER"); # Force the stack to be accepted
+$stop = 1 unless $allow_iter;
+$master = 1 if $force_master;
 
 ## add the summary statistics, and request a new iteration if needed
Index: /branches/eam_branch_20080706/ippScripts/scripts/detrend_stack.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/detrend_stack.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/detrend_stack.pl	(revision 18473)
@@ -209,5 +209,6 @@
 # Command to update the database
 $command  = "$dettool -addstacked";
-$command .= " -det_id $det_id -iteration $iter";
+$command .= " -det_id $det_id";
+$command .= " -iteration $iter";
 $command .= " -class_id $class_id";
 $command .= " -uri $outputStack";
Index: /branches/eam_branch_20080706/ippScripts/scripts/fake_imfile.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/fake_imfile.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/fake_imfile.pl	(revision 18473)
@@ -42,19 +42,20 @@
 # Parse the command-line arguments
 my ( $exp_id, $fake_id, $class_id, $chiproot, $camroot, $camera, $outroot, 
-     $dbname, $reduction, $verbose, $no_update, $no_op );
+     $dbname, $reduction, $verbose, $no_update, $no_op, $redirect  );
 GetOptions(
-	   'exp_id=s'      => \$exp_id,    # Exposure identifier
-	   'fake_id=s'     => \$fake_id,   # Chiptool identifier
-	   'class_id=s'    => \$class_id,  # Class identifier
-	   'chiproot=s'    => \$chiproot,  # Input Chip files (root)
-	   'camroot=s'     => \$camroot,   # Input Camera files (root)
-	   'camera|c=s'    => \$camera,	   # Camera
-	   'outroot|w=s'   => \$outroot,   # output file base name
-	   'dbname|d=s'    => \$dbname,    # Database name
-	   'reduction=s'   => \$reduction, # Reduction class
-	   'verbose'       => \$verbose,   # Print to stdout
-	   'no-update'     => \$no_update, # Don't update the database?
-	   'no-op'         => \$no_op,	   # Don't do any operations?
-	   ) or pod2usage( 2 );
+    'exp_id=s'      	=> \$exp_id,    # Exposure identifier
+    'fake_id=s'     	=> \$fake_id,   # Chiptool identifier
+    'class_id=s'    	=> \$class_id,  # Class identifier
+    'chiproot=s'    	=> \$chiproot,  # Input Chip files (root)
+    'camroot=s'     	=> \$camroot,   # Input Camera files (root)
+    'camera|c=s'    	=> \$camera,	   # Camera
+    'outroot|w=s'   	=> \$outroot,   # output file base name
+    'dbname|d=s'    	=> \$dbname,    # Database name
+    'reduction=s'   	=> \$reduction, # Reduction class
+    'verbose'       	=> \$verbose,   # Print to stdout
+    'no-update'     	=> \$no_update, # Don't update the database?
+    'no-op'         	=> \$no_op,	   # Don't do any operations?
+    'redirect-output'   => \$redirect,
+    ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
@@ -71,4 +72,8 @@
 $ipprc->define_camera($camera);
 
+my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+
+$ipprc->redirect_output($logDest) if $redirect;
+
 # Recipes to use based on reduction class
 $reduction = 'DEFAULT' unless defined $reduction;
@@ -116,5 +121,4 @@
 my $cameraObjects = $ipprc->filename("PSASTRO.OUTPUT",      $camroot)             or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 my $traceDest     = $ipprc->filename("TRACE.IMFILE", 	    $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $logDest       = $ipprc->filename("LOG.IMFILE", 	    $outroot, $class_id)  or &my_die("Missing entry from camera config", $exp_id, $fake_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # XXX check for existence of input data
Index: /branches/eam_branch_20080706/ippScripts/scripts/warp_overlap.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/warp_overlap.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/warp_overlap.pl	(revision 18473)
@@ -27,5 +27,5 @@
 my $ipprc = PS::IPP::Config->new(); # IPP configuration
 
-my ($warp_id, $camera, $tess_dir, $dbname, $verbose, $no_update, $no_op, $save_temps);
+my ($warp_id, $camera, $tess_dir, $dbname, $verbose, $no_update, $no_op, $logfile, $save_temps);
 GetOptions(
     'warp_id|i=s'       => \$warp_id, # Warp identifier
@@ -36,6 +36,9 @@
     'no-update'         => \$no_update, # Don't update the database?
     'no-op'             => \$no_op, # Don't do any operations
+    'logfile=s'         => \$logfile,
     'save-temps'        => \$save_temps, # Save temporary files?
 ) or pod2usage( 2 );
+
+$ipprc->redirect_output($logfile) if $logfile;
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
Index: /branches/eam_branch_20080706/ippScripts/scripts/warp_skycell.pl
===================================================================
--- /branches/eam_branch_20080706/ippScripts/scripts/warp_skycell.pl	(revision 18472)
+++ /branches/eam_branch_20080706/ippScripts/scripts/warp_skycell.pl	(revision 18473)
@@ -25,5 +25,5 @@
 my $ipprc = PS::IPP::Config->new(); # IPP configuration
 
-my ($warp_id, $skycell_id, $tess_dir, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $save_temps);
+my ($warp_id, $skycell_id, $tess_dir, $camera, $dbname, $outroot, $verbose, $no_update, $no_op, $redirect, $save_temps);
 GetOptions(
     'warp_id|i=s'       => \$warp_id, # Warp identifier
@@ -36,4 +36,5 @@
     'no-update'         => \$no_update, # Don't update the database?
     'no-op'             => \$no_op, # Don't do any operations?
+    'redirect-output'   => \$redirect,
     'save-temps'        => \$save_temps, # Save temporary files?
 ) or pod2usage( 2 );
@@ -50,4 +51,8 @@
 
 $ipprc->define_camera($camera);
+
+my $logDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
+
+$ipprc->redirect_output($logDest) if $redirect;
 
 my $STATS =
@@ -119,5 +124,4 @@
 my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id );
 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
-my $logDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id);
 
 my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id );
