Index: trunk/ippScripts/scripts/background_chip.pl
===================================================================
--- trunk/ippScripts/scripts/background_chip.pl	(revision 28536)
+++ trunk/ippScripts/scripts/background_chip.pl	(revision 33054)
@@ -42,5 +42,5 @@
 # Parse the command-line arguments
 my ( $chip_bg_id, $class_id, $camera, $outroot, $dbname, $reduction, $verbose,
-     $threads, $no_update, $save_temps, $no_op, $redirect, $deburned );
+     $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $magicked );
 GetOptions(
     'chip_bg_id=s'      => \$chip_bg_id,    # chipBackgroundRun identifier
@@ -51,4 +51,6 @@
     'reduction=s'       => \$reduction, # Reduction class
     'threads=s'         => \$threads,   # Number of threads to use
+    'chip_path_base=s'  => \$chip_path_base, # optional chip_path_base
+    'magicked=s'        => \$magicked,  # magicked status of input
     'verbose'           => \$verbose,   # Print to stdout
     'no-update'         => \$no_update, # Don't update the database?
@@ -88,6 +90,17 @@
 # Get inputs
 my $in_path;                    # Input path
-my $magicked;                   # Input is magicked?
-{
+my $do_stats;
+my $dump_config;
+if ($chip_path_base and $no_update) {
+    # we are running outside of a chip_bg_run (perhaps by the postage stamp server) don't dump config
+    # or do stats. Get path to input from command line.
+    $in_path = $chip_path_base;
+    $magicked = 0 if !defined $magicked;
+    $do_stats = 0;
+    $dump_config = 0;
+} else {
+    # normal operation. Get input parameters from the database
+    $do_stats = 1;
+    $dump_config = 1;
     my $command = "bgtool -chipinputs -chip_bg_id $chip_bg_id -class_id $class_id";
     $command .= " -dbname $dbname" if defined $dbname;
@@ -153,11 +166,11 @@
     $command .= " -image $in_image";
     $command .= " -mask $in_mask";
-    $command .= " -stats $out_stats";
+    $command .= " -stats $out_stats" if $do_stats;
     $command .= " -background $in_bg" if $apply_bg;
     $command .= " -pattern $in_pattern" if $apply_pattern;
     $command .= " -recipe PPBACKGROUND $recipe_ppBackground";
-    $command .= " -recipe PPSTATS CHIPSTATS";
+    $command .= " -recipe PPSTATS CHIPSTATS" if $do_stats;
     $command .= " -dbname $dbname" if defined $dbname;
-    $command .= " -dumpconfig $out_config";
+    $command .= " -dumpconfig $out_config" if $dump_config;
     $command .= " -tracedest $traceDest -log $logDest";
 
@@ -171,7 +184,7 @@
 
 # Gather command-line arguments from statistics
-my $cmdflags;                   # Command-line flags to add
-my $quality;                    # Quality flag
-{
+my $cmdflags = "";                  # Command-line flags to add
+my $quality = 0;                    # Quality flag
+if ($do_stats) {
     &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_stats);
 
@@ -191,7 +204,7 @@
 
 if (!$quality and !$no_op) {
-    &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_image);
-    &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_mask);
-    &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_config);
+    &my_die("Couldn't find expected output file: $out_image", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_image);
+    &my_die("Couldn't find expected output file: $out_mask", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_mask);
+    &my_die("Couldn't find expected output file: $out_config", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless !$dump_config or $ipprc->file_exists($out_config);
 
 }
