Index: trunk/ippScripts/scripts/camera_exp.pl
===================================================================
--- trunk/ippScripts/scripts/camera_exp.pl	(revision 17797)
+++ trunk/ippScripts/scripts/camera_exp.pl	(revision 17803)
@@ -29,23 +29,23 @@
      $no_op, $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?
+           'save-temps'        => \$save_temps, # Save temporary files?
+           ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-	  -msg => "Required options: --exp_tag --cam_id --camera --outroot",
-	  -exitval => 3,
-	  ) unless 
+          -msg => "Required options: --exp_tag --cam_id --camera --outroot",
+          -exitval => 3,
+          ) unless
     defined $exp_tag and
     defined $cam_id and
@@ -66,34 +66,34 @@
 # values to extract from output metadata and the stats to calculate
 # these should be coming from the psastro results
-my $CHIPSTATS = 
-    [   
-	#          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
-	{ name => "bg",             type => "mean",  flag => "-bg",            	dtype => "float" },
-	{ name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",      	dtype => "float" },  
-	{ name => "bg_mean_stdev",  type => "stdev", flag => "-bg_mean_stdev", 	dtype => "float" },
-	{ name => "bias",           type => "mean",  flag => "-bias",      	dtype => "float" },  
-	{ name => "bias_stdev",     type => "rms",   flag => "-bias_stdev",   	dtype => "float" },  
-        { name => "fringe_0",       type => "mean",  flag => "-fringe_0",      	dtype => "float" },  
-        { name => "fringe_1",       type => "rms",   flag => "-fringe_1",      	dtype => "float" },  
-        { name => "fringe_0",       type => "stdev", flag => "-fringe_2",      	dtype => "float" },  
-	{ name => "sigma_ra",       type => "rms",   flag => "-sigma_ra",      	dtype => "float" },  
-	{ name => "sigma_dec",      type => "rms",   flag => "-sigma_dec",     	dtype => "float" },  
-	{ name => "ap_resid",       type => "mean",  flag => "-ap_resid",      	dtype => "float" },  
-	{ name => "ap_resid_stdev", type => "rms",   flag => "-ap_resid_stdev", dtype => "float" },  
-	{ name => "zp_mean",        type => "mean",  flag => "-zp_mean",      	dtype => "float" },  
-	{ name => "zp_stdev",       type => "rms",   flag => "-zp_stdev",       dtype => "float" },  
-	{ name => "fwhm_major",     type => "mean",  flag => "-fwhm_major",     dtype => "float" },  
-	{ name => "fwhm_minor",     type => "mean",  flag => "-fwhm_minor",     dtype => "float" },  
-	{ name => "dtime_detrend",  type => "sum",   flag => "-dtime_detrend",  dtype => "float" },  
-	{ name => "dtime_photom",   type => "sum",   flag => "-dtime_photom",   dtype => "float" },  
-	{ name => "dtime_astrom",   type => "sum",   flag => "-dtime_astrom",   dtype => "float" },  
-	{ name => "n_stars",        type => "sum",   flag => "-n_stars",       	dtype => "int"   },  
-	{ name => "n_extended",     type => "sum",   flag => "-n_extended",     dtype => "int"   },  
-	{ name => "n_cr",           type => "sum",   flag => "-n_cr",       	dtype => "int"   },  
-	{ name => "n_astrom",       type => "sum",   flag => "-n_astrom",      	dtype => "int"   },  
+my $CHIPSTATS =
+    [
+        #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
+        { name => "bg",             type => "mean",  flag => "-bg",             dtype => "float" },
+        { name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",       dtype => "float" },
+        { name => "bg_mean_stdev",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
+        { name => "bias",           type => "mean",  flag => "-bias",           dtype => "float" },
+        { name => "bias_stdev",     type => "rms",   flag => "-bias_stdev",     dtype => "float" },
+        { name => "fringe_0",       type => "mean",  flag => "-fringe_0",       dtype => "float" },
+        { name => "fringe_1",       type => "rms",   flag => "-fringe_1",       dtype => "float" },
+        { name => "fringe_0",       type => "stdev", flag => "-fringe_2",       dtype => "float" },
+        { name => "sigma_ra",       type => "rms",   flag => "-sigma_ra",       dtype => "float" },
+        { name => "sigma_dec",      type => "rms",   flag => "-sigma_dec",      dtype => "float" },
+        { name => "ap_resid",       type => "mean",  flag => "-ap_resid",       dtype => "float" },
+        { name => "ap_resid_stdev", type => "rms",   flag => "-ap_resid_stdev", dtype => "float" },
+        { name => "zp_mean",        type => "mean",  flag => "-zp_mean",        dtype => "float" },
+        { name => "zp_stdev",       type => "rms",   flag => "-zp_stdev",       dtype => "float" },
+        { name => "fwhm_major",     type => "mean",  flag => "-fwhm_major",     dtype => "float" },
+        { name => "fwhm_minor",     type => "mean",  flag => "-fwhm_minor",     dtype => "float" },
+        { name => "dtime_detrend",  type => "sum",   flag => "-dtime_detrend",  dtype => "float" },
+        { name => "dtime_photom",   type => "sum",   flag => "-dtime_photom",   dtype => "float" },
+        { name => "dtime_astrom",   type => "sum",   flag => "-dtime_astrom",   dtype => "float" },
+        { name => "n_stars",        type => "sum",   flag => "-n_stars",        dtype => "int"   },
+        { name => "n_extended",     type => "sum",   flag => "-n_extended",     dtype => "int"   },
+        { name => "n_cr",           type => "sum",   flag => "-n_cr",           dtype => "int"   },
+        { name => "n_astrom",       type => "sum",   flag => "-n_astrom",       dtype => "int"   },
 
 
 # these are not defined for the database table camProcessedExp
-	];
+        ];
 my $chipStats = PS::IPP::Metadata::Stats->new($CHIPSTATS); # Stats parser
 
@@ -108,32 +108,32 @@
 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
 
-if ($missing_tools) { 
+if ($missing_tools) {
     warn("Can't find required tools.");
-    exit($PS_EXIT_CONFIG_ERROR); 
-}
-
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+    exit($PS_EXIT_CONFIG_ERROR);
+}
+
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 
 # Get list of component files
-my $files;			# Array of component files
+my $files;                      # Array of component files
 {
     my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
     }
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
 
     # extract the metadata for the files into a hash list
     $files = parse_md_list($metadata) or
-	&my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
 
     # extract the stats from the metadata
     unless ($chipStats->parse($metadata)) {
-	&my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR);
     }
 }
@@ -145,5 +145,5 @@
 
 # XXX we perform astrometry iff photometry output exists
-my $chipObjects; 
+my $chipObjects;
 my $chipObjectsExist = 0;
 foreach my $file (@$files) {
@@ -160,5 +160,5 @@
     # if any of the output chip photometry files exist, we can run psastro / addstar below
     if ($ipprc->file_exists($chipObjects)) {
-	$chipObjectsExist = 1;
+        $chipObjectsExist = 1;
     }
 }
@@ -171,9 +171,9 @@
 
 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
-my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1", 	$outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
-my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2", 	$outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",     $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);
+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
@@ -190,70 +190,70 @@
     # Make the jpeg for binning 1
     {
-	my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
-	$command .= " -dbname $dbname" if defined $dbname;
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
-	}
-	&my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1);
+        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
+        }
+        &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1);
     }
 
     # Make the jpeg for binning 2
     {
-	my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
-	$command .= " -dbname $dbname" if defined $dbname;
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
-	}
-	&my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2);
+        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
+        }
+        &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2);
     }
 
     # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?)
     if ($chipObjectsExist) {
-	# run psastro on the chipObjects, producing fpaObjects
-	# XXX add a ppStats call which will collect the astrometry stats
-	my $command;
-	$command  = "$psastro -list $list3Name $outroot";
-	$command .= " -tracedest $traceDest -log $logDest";
-	$command .= " -dbname $dbname" if defined $dbname;
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
-	}
-	# XXX do we want to give an error if astrometry fails here?
-	&my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
-	
-	# run addstar on the output fpaObjects (if a DVO database is defined)
-	if (defined $dvodbReal) {
-	    # XXX this construct requires the user to have a valid .ptolemyrc 
-	    # XXX which in turn points at ippconfig/dvo.site
-	    # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
-	    # XXX this needs to be converted to addstar_client...
-
-	    my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
-	    my $command;
-	    $command  = "$addstar -D CAMERA $camdir -update";
-	    $command .= " -D CATDIR $dvodbReal";
-
-	    my $realFile = $ipprc->file_resolve($fpaObjects);
-	    $command .= " $realFile";
-
-	    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-		run(command => $command, verbose => $verbose);
-	    unless ($success) {
-		$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-		&my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
-	    }
-	}
+        # run psastro on the chipObjects, producing fpaObjects
+        # XXX add a ppStats call which will collect the astrometry stats
+        my $command;
+        $command  = "$psastro -list $list3Name $outroot";
+        $command .= " -tracedest $traceDest -log $logDest";
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
+        }
+        # XXX do we want to give an error if astrometry fails here?
+        &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
+
+        # run addstar on the output fpaObjects (if a DVO database is defined)
+        if (defined $dvodbReal) {
+            # XXX this construct requires the user to have a valid .ptolemyrc
+            # XXX which in turn points at ippconfig/dvo.site
+            # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
+            # XXX this needs to be converted to addstar_client...
+
+            my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
+            my $command;
+            $command  = "$addstar -D CAMERA $camdir -update";
+            $command .= " -D CATDIR $dvodbReal";
+
+            my $realFile = $ipprc->file_resolve($fpaObjects);
+            $command .= " $realFile";
+
+            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+                run(command => $command, verbose => $verbose);
+            unless ($success) {
+                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+                &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
+            }
+        }
     }
 }
@@ -263,4 +263,5 @@
 $fpaCommand .= " -uri UNKNOWN";
 $fpaCommand .= " -path_base $outroot";
+$fpaCommand .= " -hostname $host" if defined $host;
 $fpaCommand .= " -dbname $dbname" if defined $dbname;
 $fpaCommand .= $chipStats->cmdflags();
@@ -269,9 +270,9 @@
 unless ($no_update) {
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $fpaCommand, verbose => $verbose);
+        run(command => $fpaCommand, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	warn("Unable to add result to database: $error_code\n");
-	exit($error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        warn("Unable to add result to database: $error_code\n");
+        exit($error_code);
     }
 } else {
@@ -288,6 +289,7 @@
     carp($msg);
     if (defined $cam_id and not $no_update) {
-	my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
     }
Index: trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/chip_imfile.pl	(revision 17797)
+++ trunk/ippScripts/scripts/chip_imfile.pl	(revision 17803)
@@ -28,21 +28,21 @@
      $no_update, $no_op );
 GetOptions(
-	   'exp_id=s'      => \$exp_id,    # Exposure identifier
-	   'exp_tag=s'     => \$exp_tag,   # 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
+           'exp_tag=s'     => \$exp_tag,   # 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 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera --outroot",
-	   -exitval => 3) unless
+           -exitval => 3) unless
     defined $exp_id and
     defined $exp_tag and
@@ -74,5 +74,5 @@
        { name => "ROBUST_MEDIAN",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
        { name => "ROBUST_STDEV",   type => "rms",   flag => "-bg_stdev",       dtype => "float" },
-       { name => "OVER_VAL",       type => "mean",  flag => "-bias", 	       dtype => "float" },
+       { name => "OVER_VAL",       type => "mean",  flag => "-bias",           dtype => "float" },
        { name => "OVER_VAL",       type => "stdev", flag => "-bias_stdev",     dtype => "float" },
        { name => "FRINGE_0",       type => "rms",   flag => "-fringe_0",       dtype => "float" },
@@ -107,5 +107,5 @@
 }
 
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 
 &my_die("Couldn't find input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri);
@@ -124,8 +124,8 @@
 my $outputWeight  = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 my $outputBin1    = $ipprc->filename("PPIMAGE.BIN1",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputBin2    = $ipprc->filename("PPIMAGE.BIN2",  	    $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-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);
+my $outputBin2    = $ipprc->filename("PPIMAGE.BIN2",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+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
@@ -141,8 +141,8 @@
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code);
     }
 
@@ -150,26 +150,26 @@
     $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe -";
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     }
     my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
+        &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
 
     ## allow the output images to be optional, depending on the recipe / reduction class
     my $outputImageExpect = metadataLookupBool($recipeData, 'CHIP.FITS');
     if ($outputImageExpect) {
-	&my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
+        &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
     }
 
     my $outputMaskExpect = metadataLookupBool($recipeData, 'CHIP.MASK.FITS');
     if ($outputMaskExpect) {
-	&my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
+        &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     }
 
     my $outputWeightExpect = metadataLookupBool($recipeData, 'CHIP.WEIGHT.FITS');
     if ($outputWeightExpect) {
-	&my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
+        &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
     }
 
@@ -179,5 +179,5 @@
 
     # Get the statistics on the processed image
-    my $statsFile;		# File handle
+    my $statsFile;              # File handle
     open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     my @contents = <$statsFile>; # Contents of file
@@ -185,13 +185,13 @@
 
     # parse the statistics MDC file
-    my $mdcParser = PS::IPP::Metadata::Config->new();	# Parser for metadata config files
+    my $mdcParser = PS::IPP::Metadata::Config->new();   # Parser for metadata config files
     my $metadata = $mdcParser->parse(join "", @contents);
     unless ($metadata) {
-	&my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     }
 
     # extract the stats from the metadata
     unless ($stats->parse($metadata)) {
-	&my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     }
 }
@@ -204,4 +204,5 @@
 $command .= " -uri $outputImage";
 $command .= " -path_base $outroot";
+$command .= " -hostname $host" if defined $host;
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
@@ -210,9 +211,9 @@
 unless ($no_update) {
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	warn("Unable to perform chiptool -addprocessedimfile: $error_code\n");
-	exit($error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        warn("Unable to perform chiptool -addprocessedimfile: $error_code\n");
+        exit($error_code);
     }
 } else {
@@ -230,11 +231,12 @@
     carp($msg);
     if (defined $chip_id and defined $class_id and not $no_update) {
-	my $command = "$chiptool -addprocessedimfile";
-	$command .= " -exp_id $exp_id";
-	$command .= " -chip_id $chip_id";
-	$command .= " -class_id $class_id";
-	$command .= " -code $exit_code";
-	$command .= " -uri $outputImage";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$chiptool -addprocessedimfile";
+        $command .= " -exp_id $exp_id";
+        $command .= " -chip_id $chip_id";
+        $command .= " -class_id $class_id";
+        $command .= " -code $exit_code";
+        $command .= " -uri $outputImage";
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
     }
Index: trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/diff_skycell.pl	(revision 17797)
+++ trunk/ippScripts/scripts/diff_skycell.pl	(revision 17803)
@@ -213,4 +213,5 @@
         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
         $command .= $stats->cmdflags();
+        $command .= " -hostname $host" if defined $host;
         $command .= " -dbname $dbname" if defined $dbname;
 
@@ -248,4 +249,5 @@
     if (defined $diff_id and not $no_update) {
         my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
         $command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
Index: trunk/ippScripts/scripts/register_exp.pl
===================================================================
--- trunk/ippScripts/scripts/register_exp.pl	(revision 17797)
+++ trunk/ippScripts/scripts/register_exp.pl	(revision 17803)
@@ -30,5 +30,5 @@
     'exp_id|e=s'    => \$exp_id,
     'exp_tag|t=s'   => \$exp_tag,
-    'dbname|d=s'    => \$dbname, # Database name    
+    'dbname|d=s'    => \$dbname, # Database name
     'verbose'       => \$verbose,   # Print to stdout
     'no-update'     => \$no_update,
@@ -38,5 +38,5 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage( -msg => "Required options: --exp_id --exp_tag",
-	   -exitval => 3) unless
+           -exitval => 3) unless
     defined $exp_id and
     defined $exp_tag;
@@ -47,5 +47,5 @@
 
 # values to extract from output metadata and the stats to calculate
-my $STATS = 
+my $STATS =
    [   #          register imfile
        #          label             STATISTIC          CHIPTOOL FLAG
@@ -83,10 +83,10 @@
        { name => "env_wind_dir",    type => "constant",   flag => "-env_wind_dir",    dtype => "float"  }, # external wind direction
 
-       { name => "-teltemp_m1",     type => "constant",   flag => "-teltemp_m1",      dtype => "float"  }, # Primary mirror temps (C) 		
-       { name => "-teltemp_m1cell", type => "constant",   flag => "-teltemp_m1cell",  dtype => "float"  }, # Primary mirror support temps (C)   
-       { name => "-teltemp_m2",     type => "constant",   flag => "-teltemp_m2",      dtype => "float"  }, # Secondary mirror temps (C		
-       { name => "-teltemp_spider", type => "constant",   flag => "-teltemp_spider",  dtype => "float"  }, # Spider temperatures (C)  		
-       { name => "-teltemp_truss",  type => "constant",   flag => "-teltemp_truss",   dtype => "float"  }, # Mid truss temperatures (C		
-       { name => "-teltemp_extra",  type => "constant",   flag => "-teltemp_extra",   dtype => "float"  }, # Miscellaneous temperatures (C)     
+       { name => "-teltemp_m1",     type => "constant",   flag => "-teltemp_m1",      dtype => "float"  }, # Primary mirror temps (C)
+       { name => "-teltemp_m1cell", type => "constant",   flag => "-teltemp_m1cell",  dtype => "float"  }, # Primary mirror support temps (C)
+       { name => "-teltemp_m2",     type => "constant",   flag => "-teltemp_m2",      dtype => "float"  }, # Secondary mirror temps (C
+       { name => "-teltemp_spider", type => "constant",   flag => "-teltemp_spider",  dtype => "float"  }, # Spider temperatures (C)
+       { name => "-teltemp_truss",  type => "constant",   flag => "-teltemp_truss",   dtype => "float"  }, # Mid truss temperatures (C
+       { name => "-teltemp_extra",  type => "constant",   flag => "-teltemp_extra",   dtype => "float"  }, # Miscellaneous temperatures (C)
 
        { name => "pon_time",        type => "mean",       flag => "-pon_time",        dtype => "float"  }, # time since last power on
@@ -102,7 +102,7 @@
     or (warn "can't find regtool" and $missing_tools = 1);
 
-if ($missing_tools) { 
+if ($missing_tools) {
     warn ("Can't find required tools");
-    exit($PS_EXIT_CONFIG_ERROR); 
+    exit($PS_EXIT_CONFIG_ERROR);
 }
 
@@ -120,5 +120,5 @@
         cache_run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         warn ("Unable to perform regtool -processedimfile on exposure id $exp_id: $error_code");
         exit ($error_code);
@@ -148,4 +148,5 @@
 $command .= " -exp_id $exp_id";
 $command .= " -exp_tag $exp_tag";
+$command .= " -hostname $host" if defined $host;
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
@@ -155,10 +156,10 @@
 # Add the detrend flag, if needed
 {
-    my $object = 0;		# Is it an object exposure?
+    my $object = 0;             # Is it an object exposure?
     foreach my $scienceType (@SCIENCE) {
-	if (lc($exp_type) =~ /$scienceType/) {
-	    $object = 1;
-	    last;
-	}
+        if (lc($exp_type) =~ /$scienceType/) {
+            $object = 1;
+            last;
+        }
     }
     $command .= " $DETREND_FLAG" unless $object;
@@ -170,5 +171,5 @@
         cache_run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         warn ("Unable to run regtool -addprocessedexp for $exp_id: $error_code");
         exit($error_code);
@@ -202,6 +203,7 @@
     carp($msg);
     if (defined $exp_id and not $no_update) {
-	my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -dbname $dbname" if defined $dbname;
         system($command);
     }
Index: trunk/ippScripts/scripts/register_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/register_imfile.pl	(revision 17797)
+++ trunk/ippScripts/scripts/register_imfile.pl	(revision 17803)
@@ -52,6 +52,6 @@
 
 # values to extract from output metadata and the stats to calculate
-my $STATS = 
-   [   
+my $STATS =
+   [
        #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
        { name => "FILE.LEVEL",     type => "constant", flag => "-filelevel",       dtype => "string" }, # File level
@@ -69,5 +69,5 @@
        { name => "FPA.TIME",       type => "constant", flag => "-dateobs",         dtype => "string" }, # Date of observation (UTC)
        { name => "FPA.TELESCOPE",  type => "constant", flag => "-telescope",       dtype => "string" }, # Telescope
-       { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst",            dtype => "string" }, # Instrument 
+       { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst",            dtype => "string" }, # Instrument
        { name => "FPA.M1X",        type => "constant", flag => "-m1_x",            dtype => "float"  }, # M1X
        { name => "FPA.M1Y",        type => "constant", flag => "-m1_y",            dtype => "float"  }, # M1Y
@@ -85,10 +85,10 @@
        { name => "FPA.ENV.DIR",    type => "constant", flag => "-env_wind_dir",    dtype => "float"  }, # external wind direction
 
-       { name => "FPA.TELTEMP.M1",     type => "constant", flag => "-teltemp_m1",     dtype => "float"  }, # Primary mirror temps (C) 		
-       { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float"  }, # Primary mirror support temps (C)   
-       { name => "FPA.TELTEMP.M2",     type => "constant", flag => "-teltemp_m2",     dtype => "float"  }, # Secondary mirror temps (C		
-       { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float"  }, # Spider temperatures (C)  		
-       { name => "FPA.TELTEMP.TRUSS",  type => "constant", flag => "-teltemp_truss",  dtype => "float"  }, # Mid truss temperatures (C		
-       { name => "FPA.TELTEMP.EXTRA",  type => "constant", flag => "-teltemp_extra",  dtype => "float"  }, # Miscellaneous temperatures (C)     
+       { name => "FPA.TELTEMP.M1",     type => "constant", flag => "-teltemp_m1",     dtype => "float"  }, # Primary mirror temps (C)
+       { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float"  }, # Primary mirror support temps (C)
+       { name => "FPA.TELTEMP.M2",     type => "constant", flag => "-teltemp_m2",     dtype => "float"  }, # Secondary mirror temps (C
+       { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float"  }, # Spider temperatures (C)
+       { name => "FPA.TELTEMP.TRUSS",  type => "constant", flag => "-teltemp_truss",  dtype => "float"  }, # Mid truss temperatures (C
+       { name => "FPA.TELTEMP.EXTRA",  type => "constant", flag => "-teltemp_extra",  dtype => "float"  }, # Miscellaneous temperatures (C)
 
        { name => "FPA.PON.TIME",   type => "constant", flag => "-pon_time",        dtype => "float"  }, # time since last power on
@@ -109,7 +109,7 @@
     or (warn "Can't find ppStats" and $missing_tools = 1);
 
-if ($missing_tools) { 
+if ($missing_tools) {
     warn ("Can't find required tools");
-    exit($PS_EXIT_CONFIG_ERROR); 
+    exit($PS_EXIT_CONFIG_ERROR);
 }
 
@@ -130,9 +130,9 @@
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         cache_run(command => $command, verbose => $verbose);
-    unless ($success) { 
+    unless ($success) {
         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
         &my_die ("Unable to perform ppStats on exposure id $exp_id: $error_code", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $error_code);
     }
-    
+
     # Parse the output
     my $mdcParser = PS::IPP::Metadata::Config->new;        # Parser for metadata config files
@@ -163,4 +163,5 @@
 $command .= " -tmp_class_id $tmp_class_id"; # the original class_id supplied by the user, replace by ppStats CLASS.ID
 $command .= " -uri $uri ";
+$command .= " -hostname $host" if defined $host;
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
@@ -216,9 +217,10 @@
         $command .= " -exp_name $exp_name";
         $command .= " -tmp_class_id $tmp_class_id";
-	$command .= " -uri $uri ";
+        $command .= " -uri $uri ";
         $command .= " -telescope UNKNOWN";
         $command .= " -inst UNKNOWN";
         $command .= " -class_id $tmp_class_id";
         $command .= " -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
         $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
Index: trunk/ippScripts/scripts/stack_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/stack_skycell.pl	(revision 17797)
+++ trunk/ippScripts/scripts/stack_skycell.pl	(revision 17803)
@@ -32,5 +32,5 @@
     'outroot=s'         => \$outroot, # Output root name
     'verbose'           => \$verbose,   # Print to stdout
-    'no-update'         => \$no_update,	# Don't update the database?
+    'no-update'         => \$no_update, # Don't update the database?
     'no-op'             => \$no_op, # Don't do any operations?
     'save-temps'        => \$save_temps, # Save temporary files?
@@ -41,9 +41,9 @@
     -msg => "Required options: --stack_id --outroot",
     -exitval => 3,
-	  ) unless defined $stack_id
+          ) unless defined $stack_id
     and defined $outroot;
 
-my $STATS = 
-   [   
+my $STATS =
+   [
        #          PPSTATS KEYWORD         STATISTIC          STACKTOOL FLAG
        { name => "ROBUST_MEDIAN",   type => "mean", flag => "-bg",          dtype => "float" },
@@ -58,11 +58,11 @@
 my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
 my $ppStack = can_run('ppStack') or (warn "Can't find ppStack" and $missing_tools = 1);
-if ($missing_tools) { 
+if ($missing_tools) {
     warn("Can't find required tools.");
-    exit($PS_EXIT_CONFIG_ERROR); 
+    exit($PS_EXIT_CONFIG_ERROR);
 }
 
 # Get list of components for stacking
-my $mdcParser = PS::IPP::Metadata::Config->new;	# Parser for metadata config files
+my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 my $files;
 {
@@ -70,14 +70,14 @@
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code);
     }
 
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
-    $files = parse_md_list($metadata) or 
-	&my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
+    $files = parse_md_list($metadata) or
+        &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);
 }
 
@@ -86,26 +86,26 @@
 
 # Parse the list of input files to get the tesselation, skycell identifiers and camera
-my $skycell_id;			# Skycell identifier
-my $tess_id;			# Tesselation identifier
-my $camera;			# Camera
+my $skycell_id;                 # Skycell identifier
+my $tess_id;                    # Tesselation identifier
+my $camera;                     # Camera
 foreach my $file (@$files) {
     # skip warps which are speicified as 'ignored'
     if ($file->{ignored}) { next; }
     if (defined $tess_id) {
-	&my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
-	    $file->{tess_id} eq $tess_id;
+        &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
+            $file->{tess_id} eq $tess_id;
     } else {
-	$tess_id = $file->{tess_id};
+        $tess_id = $file->{tess_id};
     }
     if (defined $skycell_id) {
-	&my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
-	    $file->{skycell_id} eq $skycell_id;
+        &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
+            $file->{skycell_id} eq $skycell_id;
     } else {
-	$skycell_id = $file->{skycell_id};
+        $skycell_id = $file->{skycell_id};
     }
     if (defined $camera) {
-	&my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
+        &my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
     } else {
-	$camera = $file->{camera};
+        $camera = $file->{camera};
     }
 }
@@ -116,7 +116,7 @@
 # Generate MDC file with the inputs
 my ($listFile, $listName) = tempfile( "$tess_id.$skycell_id.stk$stack_id.list.XXXX",
-				      UNLINK => !$save_temps );
+                                      UNLINK => !$save_temps );
 my $num = 0;
-my $inputSources;		# Sources to use as stamps
+my $inputSources;               # Sources to use as stamps
 foreach my $file (@$files) {
     if ($file->{ignored}) { next; }
@@ -125,5 +125,5 @@
     $num++;
 
-    my $image = $file->{uri};	# Image name
+    my $image = $file->{uri};   # Image name
     my $mask = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name
     my $weight = $ipprc->filename( "PSWARP.OUTPUT.WEIGHT", $file->{path_base} ); # Weight name
@@ -134,8 +134,8 @@
     &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $weight );
     &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $psf );
-   
+
     print $listFile "\tIMAGE\tSTR\t" . $image . "\n";
-    print $listFile "\tMASK\tSTR\t" . $mask . "\n"; 
-    print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n"; 
+    print $listFile "\tMASK\tSTR\t" . $mask . "\n";
+    print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n";
     print $listFile "\tPSF\tSTR\t" . $psf . "\n";
 
@@ -147,8 +147,8 @@
     # XXX details about supplying sources, etc, need to be specified in the libraries
     unless (defined $inputSources) {
-	$inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base});
-	&my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources );
-    }
-	
+        $inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base});
+        &my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources );
+    }
+
 }
 
@@ -175,8 +175,8 @@
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	run(command => $command, verbose => $verbose);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);
     }
     &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
@@ -189,10 +189,10 @@
 
     # Get the statistics on the stacked image
-    my $statsFile;		# File handle
+    my $statsFile;              # File handle
     open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR);
     my @contents = <$statsFile>; # Contents of file
     close $statsFile;
     my $metadata = $mdcParser->parse(join "", @contents) or
-	&my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR);
 }
@@ -202,28 +202,29 @@
     # Add the stack result
     {
-	my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot";
-	$command .= $stats->cmdflags();
-	$command .= " -dbname $dbname" if defined $dbname;
-	
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code);
-	}
+        my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot";
+        $command .= $stats->cmdflags();
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code);
+        }
     }
 
     # Register the run as completed
     {
-	my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
-	$command .= " -dbname $dbname" if defined $dbname;
-
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    warn("Unable to perform stacktool -updaterun: $error_code\n");
-	    exit($error_code);
-	}
+        my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
+        $command .= " -dbname $dbname" if defined $dbname;
+
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        unless ($success) {
+            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+            warn("Unable to perform stacktool -updaterun: $error_code\n");
+            exit($error_code);
+        }
     }
 }
@@ -232,12 +233,13 @@
 sub my_die
 {
-    my $msg = shift;		# Warning message on die
-    my $stack_id = shift;	# Stack identifier
-    my $exit_code = shift;	# Exit code to add
+    my $msg = shift;            # Warning message on die
+    my $stack_id = shift;       # Stack identifier
+    my $exit_code = shift;      # Exit code to add
 
     warn($msg);
     if (defined $stack_id and not $no_update) {
-	my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code";
-	$command .= " -dbname $dbname" if defined $dbname;
+        my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
+        $command .= " -dbname $dbname" if defined $dbname;
         system ($command);
     }
Index: trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/warp_skycell.pl	(revision 17797)
+++ trunk/ippScripts/scripts/warp_skycell.pl	(revision 17803)
@@ -219,4 +219,5 @@
     $command .= " -uri $outputImage -path_base $outroot" if $accept;
     $command .= $stats->cmdflags() if $accept;
+    $command .= " -hostname $host" if defined $host;
     $command .= " -dbname $dbname" if defined $dbname;
 
@@ -241,4 +242,5 @@
     if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) {
         my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
+        $command .= " -hostname $host" if defined $host;
         $command .= " -dbname $dbname" if defined $dbname;
         run(command => $command, verbose => $verbose);
