Index: trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 10719)
+++ trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 11297)
@@ -18,5 +18,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type, $camera, $filter, $no_update);
+my ($det_id, $iter, $det_type, $camera, $filter, $dbname, $no_update);
 GetOptions(
 	   'det_id|d=s'        => \$det_id,
@@ -25,4 +25,5 @@
 	   'camera=s'          => \$camera,
 	   'filter=s'          => \$filter,
+	   'dbname|d=s'        => \$dbname, # Database name
 	   'no-update'         => \$no_update
 ) or pod2usage( 2 );
@@ -48,4 +49,5 @@
 {
     my $command = "$dettool -residexp -det_id $det_id -iteration $iter"; # Command to run
+    $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -105,4 +107,6 @@
     $expTag = $expTags[$i];	# Exposure ID
     $command = "$dettool -updateresidexp -det_id $det_id -iteration $iter -exp_tag $expTag"; # Command to run
+    $command .= " -dbname $dbname" if defined $dbname;
+
     $reject = 0;		# Reject this exposure?
 
@@ -197,5 +201,6 @@
 	" -bg_mean_stdev " . $meanStats->standard_deviation();
     $command .= " -accept" if $master;
-    
+    $command .= " -dbname $dbname" if defined $dbname;
+
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -211,4 +216,6 @@
 	$command .= ' -again';
     }
+    
+    $command .= " -dbname $dbname" if defined $dbname;
     
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
