Index: trunk/ippScripts/scripts/detrend_apply_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_apply_norm.pl	(revision 9091)
@@ -17,5 +17,6 @@
     $input,			# Input file
     $camera,			# Camera
-    $detType			# Detrend type
+    $detType,			# Detrend type
+    $no_update			# Don't update the database
     );
 GetOptions(
@@ -26,5 +27,6 @@
     'input_uri|u=s'     => \$input,
     'camera|c=s'        => \$camera,
-    'det_type|t=s'      => \$detType
+    'det_type|t=s'      => \$detType,
+    'no-update'         => \$no_update
     ) or pod2usage( 2 );
     
@@ -62,5 +64,5 @@
 
 # Update the database
-{
+unless ($no_update) {
     my $command = "$dettool -addnormalizedimfile -det_id $detId -iteration $iter -class_id $classId ".
 	"-uri $output"; # Command to run
Index: trunk/ippScripts/scripts/detrend_calc_norm.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_calc_norm.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_calc_norm.pl	(revision 9091)
@@ -16,9 +16,11 @@
 # Parse command-line arguments
 my ($detId,			# Detrend id
-    $iter			# Iteration
+    $iter,			# Iteration
+    $no_update			# Don't update the database?
     );
 GetOptions(
 	'det_id|d=s'	=> \$detId,
 	'iteration|i=s'	=> \$iter,
+        'no-update'     => \$no_update
 	) or pod2usage( 2 );
 
@@ -94,5 +96,5 @@
 
 # Process output normalisations
-{
+unless ($no_update) {
     foreach my $normItem (@$norms) {
 	my $className = $normItem->{name}; # Name of component
Index: trunk/ippScripts/scripts/detrend_create_resid.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_create_resid.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_create_resid.pl	(revision 9091)
@@ -16,5 +16,5 @@
 
 my ($det_id, $iter, $exp_id, $class_id, $det_type, $detrend,
-        $input_uri);
+        $input_uri, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -25,4 +25,5 @@
     'detrend=s'         => \$detrend,
     'input_uri|u=s'     => \$input_uri,
+    'no-update'         => \$no_update
 ) or pod2usage( 2 );
 
@@ -104,5 +105,5 @@
 
 # Add the processed file to the database
-{
+unless ($no_update) {
     my $command = "$dettool -addresidimfile -det_id $det_id -iteration $iter -exp_id $exp_id " .
 	"-class_id $class_id -recip $recipe -uri $outputName -b1_uri $bin1Name " .
Index: trunk/ippScripts/scripts/detrend_process.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_process.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_process.pl	(revision 9091)
@@ -14,5 +14,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_id, $class, $class_id, $det_type, $input_uri, $output_uri);
+my ($det_id, $exp_id, $class, $class_id, $det_type, $input_uri, $output_uri, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -22,4 +22,5 @@
     'det_type|t=s'      => \$det_type,
     'input_uri|u=s'     => \$input_uri,
+    'no-update'         => \$no_update
 ) or pod2usage( 2 );
 
@@ -85,5 +86,5 @@
 
 # Add the processed file to the database
-{
+unless ($no_update) {
     my $command = "$dettool -addprocessed -det_id $det_id -exp_id $exp_id " .
 	"-class_id $class_id -recip $recipe -uri $outputImage"; # Command to run dettool
Index: trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 9091)
@@ -15,9 +15,10 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type);
+my ($det_id, $iter, $det_type, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
     'iteration=s'       => \$iter,
     'det_type|t=s'      => \$det_type,
+    'no-update'         => \$no_update
 ) or pod2usage( 2 );
 
@@ -158,27 +159,29 @@
 
 # Put the result into the database
-{
-    my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter " .
-	"-bg " . $meanStats->mean() . " -bg_stdev " . $stdevStats->mean() .
-	" -bg_mean_stdev " . $meanStdevStats->mean();
-    $command .= " -reject" if not $master;
-
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
-    die "Unable to perform dettool -adddetrunsummary: $error_code\n" if not $success;
-}
-
-# Re-run processing if required
-{
-    my $command = "$dettool -updatedetrun -det_id $det_id";
-    if ($stop) {
-	$command .= ' -stop';
-    } else {
-	$command .= ' -again';
+unless ($no_update) {
+    {
+	my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter " .
+	    "-bg " . $meanStats->mean() . " -bg_stdev " . $stdevStats->mean() .
+	    " -bg_mean_stdev " . $meanStdevStats->mean();
+	$command .= " -reject" if not $master;
+	
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => 1);
+	die "Unable to perform dettool -adddetrunsummary: $error_code\n" if not $success;
     }
     
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => 1);
-    die "Unable to perform dettool -updatedetrun: $error_code\n" if not $success;
+    # Re-run processing if required
+    {
+	my $command = "$dettool -updatedetrun -det_id $det_id";
+	if ($stop) {
+	    $command .= ' -stop';
+	} else {
+	    $command .= ' -again';
+	}
+	
+	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	    run(command => $command, verbose => 1);
+	die "Unable to perform dettool -updatedetrun: $error_code\n" if not $success;
+    }
 }
 __END__
Index: trunk/ippScripts/scripts/detrend_reject_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 9091)
@@ -15,5 +15,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $exp_id, $det_type);
+my ($det_id, $iter, $exp_id, $det_type, $no_update);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -21,4 +21,5 @@
     'exp_id|e=s'        => \$exp_id,
     'det_type|t=s'      => \$det_type,
+    'no-update'         => \$no_update
 ) or pod2usage( 2 );
 
@@ -193,5 +194,5 @@
 
 # Add the result into the database
-{
+unless ($no_update) {
     my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_id $exp_id " .
 	"-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $jpeg1Name -b2_uri $jpeg2Name " .
Index: trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- trunk/ippScripts/scripts/detrend_stack.pl	(revision 9090)
+++ trunk/ippScripts/scripts/detrend_stack.pl	(revision 9091)
@@ -22,4 +22,5 @@
     'det_type|t=s'      => \$det_type,
     'camera|c=s'        => \$camera,
+    'no-update'         => \$no_update
 ) or pod2usage( 2 );
 
@@ -111,5 +112,5 @@
 
 # Add the resultant into the database
-{
+unless ($no_update) {
     my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" .
 	" -uri $outputStack -recip $recipe"; # Command to run
Index: trunk/ippScripts/scripts/phase0exp.pl
===================================================================
--- trunk/ippScripts/scripts/phase0exp.pl	(revision 9090)
+++ trunk/ippScripts/scripts/phase0exp.pl	(revision 9091)
@@ -10,4 +10,20 @@
 use Data::Dumper;
 
+use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
+
+my ($expid, $no_update);
+
+GetOptions(
+    'exp_id|e=s'    => \$expid,
+    'no-update'     => \$no_update
+) or pod2usage( 2 );
+
+pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+pod2usage(
+    -msg => "Required options: --exp_id",
+    -exitval => 3,
+) unless defined $expid;
+
+# Define setup
 use constant TYPE => "exp_type"; # Observation type keyword
 use constant DETRENDS => [ "bias", "dark", "flat", "fringe" ]; # Observation types to mark as detrend
@@ -42,10 +58,4 @@
 ###                           "time" # Time of exposure --- not yet implemented
                            ];
-
-if (scalar @ARGV == 0 || scalar @ARGV >= 2) {
-    die "Perform phase 0 processing at the exposure level.\n\n" .
-        "Usage: $0 EXP_ID\n\n";
-}
-my $expid = shift @ARGV;        # Exposure id
 
 
@@ -106,5 +116,5 @@
 
 # Output results to the database
-{
+unless ($no_update) {
     my $command = "$p0tool -updateexp -exp_id $expid"; # Command to execute to update exposure parameters
     
