Index: /trunk/ippScripts/scripts/sc_prepare_camera.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_prepare_camera.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_prepare_camera.pl	(revision 37102)
@@ -18,5 +18,6 @@
 
 # Hard coded values
-my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+# my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+my $remote_root   = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location
 my $threads       = 2;                      # How many threads are we going to use?
 my $job_cost      = 1700 / 60 / 60;         # Estimate of how long a job runs, in hours.
@@ -27,5 +28,5 @@
 my $max_time      = 8;                      # longest allocation to ask for
 my $remote_hostname= "LANL/Mustang";         # Name of the remote node.
-my @return_component_list = ("DBINFO.EXP", "PSASTRO.CONFIG", "PSASTRO.OUTPUT", "LOG.EXP","TRACE.EXP", "PSASTRO.STATS");
+my @return_component_list = ("DBINFO.EXP", "PSASTRO.CONFIG", "PSASTRO.OUTPUT", "LOG.EXP", "PSASTRO.STATS");
 # Look for programs we need
 my $missing_tools;
@@ -186,5 +187,5 @@
     $psastro_command   .= " -recipe PSASTRO $recipe_psastro ";
     $psastro_command   .= " -tracedest ${remote_outroot}.trace -log ${remote_outroot}.log ";
-    $psastro_command   .= " -dumpconfig ${remote_outroot}.mdc -stats ${remote_outroot}.stats ";
+    $psastro_command   .= " -dumpconfig ${remote_outroot}.psastro.mdc -stats ${remote_outroot}.stats ";
     $psastro_command   .= " -recipe PPSTATS CAMSTATS ";
     
@@ -202,5 +203,5 @@
 	my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename);
 	my $remote_outroot_dir = dirname($ipp_disk);
-	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} ";
+	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk ";
     }
     foreach my $chipInfo (@{ $inpData2 }) {
@@ -208,5 +209,5 @@
 	my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename);
 	my $remote_outroot_dir = dirname($ipp_disk);
-	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} ";
+	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk ";
     }
     print CONFIG "\n";
@@ -239,4 +240,5 @@
     $node_req = int(($node_need * $job_cost) / ($fill_factor * $time_req)) + 1;
 }
+$time_req += 1; # Safety addition.
 
 open(COMMAND,  ">$disk_command") || &my_die("Couldn't open file? $disk_command",$remote_id,$PS_EXIT_SYS_ERROR);
Index: /trunk/ippScripts/scripts/sc_prepare_chip.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_prepare_chip.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_prepare_chip.pl	(revision 37102)
@@ -18,5 +18,6 @@
 
 # Hard coded values
-my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+# my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+my $remote_root   = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location
 my $remote_raw    = "${remote_root}/raw/";  # Directory to find raw data in.
 my $threads       = 2;                      # How many threads are we going to use?
@@ -152,5 +153,5 @@
 #print Dumper(%detrends);
 
-my @return_component_list = ("DBINFO.IMFILE","PPIMAGE.STATS","LOG.IMFILE","TRACE.IMFILE","PPIMAGE.BACKMDL","PPIMAGE.PATTERN");
+my @return_component_list = ("DBINFO.IMFILE","PPIMAGE.STATS","LOG.IMFILE","PPIMAGE.BACKMDL","PPIMAGE.PATTERN");
 
 #
@@ -348,5 +349,5 @@
 	    my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename );
 	    my $remote_outroot_dir = dirname($ipp_disk);
-	    print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} ";
+	    print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk ";
 #	    print "  $filename $ipp_disk $remote_disk\n";
 #	    die;
@@ -405,4 +406,5 @@
     $node_req = int(($node_need * $job_cost) / ($fill_factor * $time_req)) + 1;
 }
+$time_req += 1; # Safety addition.
 
 open(COMMAND,  ">$disk_command") || &my_die("Couldn't open file? $disk_command",$chip_id,$PS_EXIT_SYS_ERROR);
Index: /trunk/ippScripts/scripts/sc_prepare_stack.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_prepare_stack.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_prepare_stack.pl	(revision 37102)
@@ -18,5 +18,6 @@
 
 # Hard coded values
-my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+#my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+my $remote_root   = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location
 my $threads       = 2;                      # How many threads are we going to use?
 my $job_cost      = 1500 / 60 / 60;           # Estimate of how long a job runs, in hours.
@@ -29,6 +30,6 @@
 my @return_component_list = ("DBINFO.EXP", "PPSTACK.UNCONV","PPSTACK.UNCONV.MASK","PPSTACK.UNCONV.VARIANCE",
 			     "PPSTACK.UNCONV.EXP","PPSTACK.UNCONV.EXPWT","PPSTACK.UNCONV.EXPNUM","PSPHOT.OUTPUT",
-			     "LOG.EXP","TRACE.EXP", "PSASTRO.STATS",
-			     "PPSTACK.CONFIG","PPSTACK.TARGET.PSF");
+			     "LOG.EXP", "PSASTRO.STATS",
+			     "PPSTACK.CONFIG","PPSTACK.TARGET.PSF","PSPHOT.STACK.PSF.SAVE");
 #,"PPSTACK.CONV.KERNEL");
 # Look for programs we need
@@ -208,5 +209,5 @@
 	my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename);
 	my $remote_outroot_dir = dirname($ipp_disk);
-	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} ";
+	print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk ";
     }
 
Index: /trunk/ippScripts/scripts/sc_prepare_warp.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_prepare_warp.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_prepare_warp.pl	(revision 37102)
@@ -18,5 +18,6 @@
 
 # Hard coded values
-my $remote_root   = '/scratch3/watersc1/';  # Far side destination base location
+# my $remote_root   = '/scratch3/watersc1/';  
+my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/'; # Far side destination base location
 my $threads       = 2;                      # How many threads are we going to use?
 my $job_cost      = 70 / 60 / 60;           # Estimate of how long a job runs, in hours.
@@ -27,5 +28,5 @@
 my $max_time      = 8;                      # longest allocation to ask for
 my $remote_hostname= "LANL/Mustang";         # Name of the remote node.
-my @return_component_list = ("DBINFO.EXP", "PSWARP.CONFIG", "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.VARIANCE", "PSWARP.OUTPUT.SOURCES","PSPHOT.PSF.SAVE","LOG.EXP","TRACE.EXP");
+my @return_component_list = ("DBINFO.EXP", "PSWARP.CONFIG", "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.VARIANCE", "PSWARP.OUTPUT.SOURCES","PSPHOT.PSF.SKY.SAVE","LOG.EXP");
 # Look for programs we need
 my $missing_tools;
@@ -202,5 +203,5 @@
 	$pswarp_command    .= " -threads 4 "; # -image_id ${image_id} -source_id ${source_id} ";
 	$pswarp_command    .= " -recipe PPSTATS WARPSTATS ";
-	$pswarp_command    .= " -dumpconfig ${remote_outroot}.mdc -stats ${remote_outroot}.stats ";
+	$pswarp_command    .= " -dumpconfig ${remote_outroot}.pswarp.mdc -stats ${remote_outroot}.stats ";
 
 #	print "$pswarp_command \n";
@@ -218,8 +219,8 @@
 	# Determine which output files need to be returned
 	foreach my $component(@return_component_list) {
-	    my $filename = $ipprc->filename($component,$ipp_outroot);
+	    my $filename = $ipprc->filename($component,$ipp_outroot,$skycell_id);
 	    my ($ipp_disk, $remote_disk) = uri_to_outputs_for_return( $filename);
 	    my $remote_outroot_dir = dirname($ipp_disk);
-	    print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} ";
+	    print CONFIG " && mkdir -p ${remote_root}/tmp/${remote_outroot_dir} && ln -sf $remote_disk ${remote_root}/tmp/${ipp_disk} && touch $remote_disk ";
 	}
 
@@ -255,4 +256,5 @@
     $node_req = int(($node_need * $job_cost) / ($fill_factor * $time_req)) + 1;
 }
+$time_req += 1; # Safety addition.
 
 open(COMMAND,  ">$disk_command") || &my_die("Couldn't open file? $disk_command",$remote_id,$PS_EXIT_SYS_ERROR);
Index: /trunk/ippScripts/scripts/sc_remote_exec.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_remote_exec.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_remote_exec.pl	(revision 37102)
@@ -18,6 +18,6 @@
 my $SEC_HOST = 'mu-fe4';
 my $IPP_PATH = '/turquoise/usr/projects/cosmo/mswarren/ipp/';
-my $remote_root  = '/scratch3/watersc1/';
-
+#my $remote_root  = '/scratch3/watersc1/';
+my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/';
 # tools
 my $missing_tools;
@@ -33,6 +33,7 @@
 
 # Options
-my ($remote_id,$path_base,$policy,$poll,$job_id,$dbname,$verbose,$no_update,$camera);
-
+my ($remote_id,$path_base,$policy,$poll,$force,$job_id,$dbname,$verbose,$no_update,$camera);
+$force = 0;
+$verbose = 0;
 GetOptions(
     'remote_id=s'   => \$remote_id,
@@ -41,4 +42,5 @@
     'policy=s'      => \$policy,
     'poll'          => \$poll,
+    'force-poll'    => \$force,
     'camera=s'      => \$camera,
     'dbname=s'      => \$dbname,
@@ -61,4 +63,20 @@
 
 print "passed authentication challenge.\n";
+
+# Phase 1.5: Grab the information about this run;
+my $rt_cmd = "$remotetool -listrun -remote_id $remote_id ";
+$rt_cmd   .= " -dbname $dbname " if defined($dbname);
+my ( $rt_success, $rt_error_code, $rt_full_buf, $rt_stdout_buf, $rt_stderr_buf ) =
+    run(command => $rt_cmd, verbose => $verbose);
+unless ($rt_success) {
+    $rt_error_code = (($rt_error_code >> 8) or $PS_EXIT_PROG_ERROR);
+    &my_die("UNable to run remotetool to determine remote run status",
+	    $remote_id,$rt_error_code);
+}
+my $rrData = $mdcParser->parse(join "", @$rt_stdout_buf) or 
+    &my_die("UNable to run remotetool to determine remote run status",
+	    $remote_id,$rt_error_code);
+my $rrData2 = parse_md_list($rrData);
+my $runData = ${ $rrData2 }[0]; # There should be only one
 
 # These are operations we only need to do on the first call, not on subsequent poll operations.
@@ -92,5 +110,5 @@
     my (undef,$remote_check) = uri_convert($uri_check);
     my (undef,$remote_transfer)= uri_convert($uri_transfer);
-#    my $ssh_check_stdout = ssh_exec_command("${remote_root}/sc_validate_files.pl --check_list $remote_check --transfer_list $remote_transfer");
+
     my $ssh_check_stdout = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_check --fetch $remote_transfer");
     # We no longer need to parse this output, as it retrieves files itself.
@@ -130,8 +148,12 @@
 # Poll the job status?
 my $poll_count = 0;
-my $poll_max   = 5;
+my $poll_max   = 1; # If it isn't finished now, it's unlikely to magically finish in the next five minutes.
 my $poll_sleep = 60;
 my $poll_response = 0;
-while (($poll_count < $poll_max)&&($poll_response != 1)&&($poll_response != -1)) {
+if ($force) {
+    $poll_response = 1;
+}
+my $poll_word  = "nothing";
+while (($poll_count < $poll_max)&&($poll_response != 1)&&($poll_response != -1)&&($force != 1)) {
     if ($verbose) {
 	print "Polling code.  Sleeping.  $poll_count of $poll_max $poll_response\n";
@@ -140,5 +162,5 @@
 	sleep($poll_sleep);
     }
-    $poll_response = poll_job($job_id);
+    ($poll_response,$poll_word) = poll_job($job_id);
 
     if ($poll_response == 1) { # This job has completed
@@ -146,5 +168,7 @@
     }
     elsif ($poll_response == -1) { # This job has an error
-	&my_die("The job exited incorrectly.",$remote_id, $PS_EXIT_PROG_ERROR);
+	warn("The job exited incorrectly: $remote_id $job_id $poll_word.  Attempting to recover what we can.");
+	$poll_response = 1; # To fool the check later into proceding
+#	&my_die("The job exited incorrectly.",$remote_id, $PS_EXIT_PROG_ERROR);
     }
     $poll_count++;
@@ -165,35 +189,92 @@
 my $uri_return  = $path_base . ".return";
 my ($ipp_return,$remote_return) = uri_convert($uri_return);
-scp_get($remote_return,$ipp_return);
-# Feed teh return list into the 
-my $return_push_output = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_return");
-print "$return_push_output\n";
-
-
+# We shouldn't need to get this file.  We made that file.
+#scp_get($remote_return,$ipp_return);
+
+# Check to see if we can resume.  Pack the files into an array
+my @returned_files = ();
+my @dbinfo_files   = ();
+my @dbindex        = ();
+my $iter           = 0;
 open(RETURN,   "$ipp_return") || &my_die("Couldn't open file? $ipp_return", $remote_id,$PS_EXIT_SYS_ERROR);
-while(<RETURN>) {
+while (<RETURN>) {
     chomp;
+    push @returned_files, $_;
     if ($_ =~ /dbinfo/) {
-	my $file = $_;
-#	$file =~ s/${remote_root}.tmp//; THis shouldn't be needed, as the transfer tool munges the files on that side.
-	open(DBF,"$file") || warn "Missing file $file\n";
-	my $cmd = <DBF>;
-	chomp($cmd);
-	$cmd =~ s/-/ -/g; # This is just a safety check for missing space.
-	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $cmd, verbose => $verbose);
-	unless ($success) {
-	    # This shouldn't fail, but we also can't suddenly abort if something does fail.  Maybe retry if this looks to be a continuing issue?
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    warn("The command that shouldn't fail has failed: $cmd $remote_id $error_code");##,$remote_id,$error_code);
-	}
-	close(DBF);
-    }
+	push @dbinfo_files, $_;
+	push @dbindex, $iter;
+    }
+    $iter++;
+
 }
 close(RETURN);
+
+# Binary search it.  BUT: We're binary searching binary values.  So,
+# this has to be far more careful than a fully sorted case would be.
+# Only scan the dbinfo files as those are the things that are
+# generated after the processing, and so must be the last things to
+# exist.
+
+my $first = 0;
+my $last  = $#dbinfo_files;
+my $mid   = 0;
+my $range = 20;  # How wide of a chunk to look through to catch threading drops
+my $offset = 0;  # Offset to start from.
+if (( stat($dbinfo_files[$last]) )[7] != 0) { $offset = $#dbinfo_files;}
+else {
+    my $count = 0;
+    while ($first < $last - $range) {
+
+	$mid = int(($last + $first)/2);
+	for (my $i = 0; $i <= $range; $i++) {
+	    my $size = (stat($dbinfo_files[$mid + $i]))[7];
+#	    print STDERR "$first $last $mid $i $size $dbinfo_files[$mid + $i]\n";
+	    if ($size == 0) { 
+		if ($last == $mid + $i) { 
+		    $first = $last - 1;
+		}
+		$last = $mid + $i; 
+		$i = $range + 10;
+	    }
+	}
+	if ($last > $mid + $range) { $first = $mid + $range; }
+	$count++;
+	if ($count > 200) { 
+	    &my_die("The iteration loop couldn't converge after 200 rounds, suggesting something has gone wrong.",
+		    $remote_id,4,"error_run");
+	}
+    }
+    $offset = $mid - $range; # Because I want to make sure I get to the beginning of the thread group.
+    $offset = $dbindex[$offset]; # Because we need to convert from dbinfo space to returned file space.
+}
+
+# Feed teh return list into the transfer tool
+# If this fails, we should go to an auth wait point.
+my $return_push_output = ssh_exec_command("${remote_root}/sc_transfer_tool.pl --input $remote_return --offset $offset");
+my $return_push_output_print = join "\n", @{ $return_push_output };
+print "$return_push_output_print\n";
+
+#die();
+
+foreach my $file (@dbinfo_files) {
+    open(DBF,"$file") || warn "Missing file $file\n";
+    my $cmd = <DBF>;
+    close(DBF);
+    chomp($cmd);
+    $cmd =~ s/-/ -/g; # This is just a safety check for missing space.
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+	run(command => $cmd, verbose => $verbose);
+    unless ($success) {
+	# This shouldn't fail, but we also can't suddenly abort if something does fail.  
+	# Now we're going to drop the component that owns this dbinfo, which should force a retry.
+	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	warn("The command that shouldn't fail has failed: $cmd $remote_id $error_code");
+	drop_component($remote_id,$cmd,$file);
+    }
+
+}
 
 # We're done, so set the state and exit.
 &my_die("Finished",$remote_id,0,"full");
-
 
 
@@ -209,10 +290,4 @@
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
 	&my_die("Authorization check failed.",$remote_id,0,'auth');
-
-# 	my $update_command = "$remotetool -updaterun -remote_id $remote_id ";
-# 	$update_command .= " -set_state auth ";
-# 	$update_command .= " -dbname $dbname " if defined $dbname;
-# 	system($update_command);
-# 	exit(0);  # This isn't an error.  It's a state we monitor and move to automatically.
     }
 }
@@ -250,9 +325,11 @@
 sub ssh_exec_command {
     my $cmd = shift;
-    $cmd = "$ssh $DMZ_HOST ssh ${SEC_HOST} $cmd";
+    $cmd = "$ssh  $DMZ_HOST ssh  ${SEC_HOST} $cmd";
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $cmd, verbose => $verbose);
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+	# If we failed, see if we failed due to authorization.
+	check_ssh_connection(); 
 	&my_die("Failed to execute command: >>$cmd<<"); 
     }
@@ -266,14 +343,17 @@
     
     if ($response =~ /State: Running/) { 
-	return(0);
+	return(0,"Running");
     }
     elsif ($response =~ /State: Completed/) {
-	return(1);
+	return(1,"Completed");
     }
     elsif ($response =~ /State: Idle/) {
-	return(-2);
+	return(-2,"Idle");
     }
     else {
-	return(-1);
+	my $response_word = $response;
+	$response_word =~ s/.*State: //;
+	$response_word =~ s/\n.*//;
+	return(-1,$response_word);
     }
 }
@@ -324,4 +404,38 @@
     return($local_uri);
 }
+
+sub drop_component {
+    my $remote_id = shift;
+    my $cmd = shift;
+    my $file = shift;
+
+    if ($cmd eq '') { 
+	# Zero byte file.  This dbinfo was never constructed properly.
+	
+	# Steal the stage_id from the filename.  This isn't something I'm happy about.
+	my $stage = $runData->{stage};
+	my $stage_id = $file;
+	if ($stage eq 'chip') { 
+	    $stage_id =~ s/^.*ch\.//;
+	}
+	elsif ($stage eq 'camera') {
+	    $stage_id =~ s/^.*cm\.//;
+	}
+	elsif ($stage eq 'warp') {
+	    $stage_id =~ s/^.*wrp\.//;
+	}
+	elsif ($stage eq 'stack') {
+	    $stage_id =~ s/^.*stk\.//;
+	}
+	$stage_id =~ s/\..*$//;
+	
+	# Drop this from the database
+	my $drop_cmd = "$remotetool -dropcomponent -remote_id $remote_id -stage_id $stage_id ";
+	$drop_cmd   .= " -dbname $dbname " if defined($dbname);
+	system($drop_cmd);
+    }
+
+}
+
 sub my_die {
     my $msg = shift;
@@ -347,51 +461,4 @@
 }
 
-# I don't think I need this anymore, but I don't want to burn it until I"m sure.
-
-# exit(1);
-# # Read this as a metadata object
-# my $ssh_exec_stdout = ssh_exec_command("sc_validate_processing.pl ${path_base}.out");
-# my $retrieveData = $mdcParser->parse(join "", @$ssh_exec_stdout);
-# my $retrieveData2= parse_md_list($retrieveData);
-
-# foreach my $retrieveEntry (@$retrieveData2) {
-#     my $process_fault = $retrieveEntry->{fault};
-#     my $dbcommand = $retrieveEntry->{dbcommand};
-#     my $filelist  = $retrieveEntry->{filelist};
-
-#     scp_get("${filelist}",${filelist});
-#     open(FL,${filelist});
-#     while(<FL>) {
-# 	chomp;
-# 	my $f = $_;
-# 	scp_get("${f}",$f);
-#     }
-#     close(FL);
-
-#     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-# 	run(command => $dbcommand, verbose => $verbose);
-#     unless ($success) {
-# 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-# 	&my_die("The database command returned did not execute correctly. $dbcommand $process_fault",
-# 		$remote_id,$error_code); 
-#     }
-
-#     if ($process_fault != 0) {
-# 	$fault = 1;
-#     }
-# }
-
-# if (($policy ne 'ignore')&&($fault != 0)) {
-#     &my_die("This job exited without all components finishing successfully.  Halting.",
-# 	    $remote_id,$fault,"halt");
-# }
-# else {
-#     print "This job exited without all components finishing successfully. $fault\n" if $fault;
-#     &my_die("This job finished.  Setting remote job to full.",
-# 	    $remote_id,0,"full");
-# }
-
-# Promote to finished.
-#&my_die(); # Not really, but I don't have the tool interface finished, so these are all just placeholders.
 # Quick review:
 # new -> pending -> run -> full
Index: /trunk/ippScripts/scripts/sc_transfer_tool.pl
===================================================================
--- /trunk/ippScripts/scripts/sc_transfer_tool.pl	(revision 37101)
+++ /trunk/ippScripts/scripts/sc_transfer_tool.pl	(revision 37102)
@@ -10,6 +10,8 @@
 use Sys::Hostname;
 
-my $local_raw = '/scratch3/watersc1/raw/';
-my $local_tmp = '/scratch3/watersc1/tmp/';
+my $remote_root = '/lustre/scratch1/turquoise/watersc1/ps1/';
+
+my $local_raw = "${remote_root}/raw/";
+my $local_tmp = "${remote_root}/tmp/";
 my $threads = 10;
 my @hosts = ('ippc20.ipp.ifa.hawaii.edu','ippc24.ipp.ifa.hawaii.edu','ippc28.ipp.ifa.hawaii.edu',
@@ -68,5 +70,7 @@
     }
     elsif (!($fetch)) { # We are pushing
-	print { $filehandles[$i] } "${local_tmp}/$_" . "\n";
+	# The rsync call expects to find files of a given name in the directory specified.
+#	print { $filehandles[$i] } "${local_tmp}/$_" . "\n";
+	print { $filehandles[$i] } "$_" . "\n";
     }
 }
@@ -112,5 +116,6 @@
 
     # the transform bit is there because it looks like the ' gets dropped, so the * is interpreted, and why is our tar so out of date?
-    my $command = "tar cf - --ignore-failed-read --dereference --files-from=${transfer_filelist} | /usr/projects/cosmo/amd6100/bin/ssh -o NoneSwitch=yes -o NoneEnabled=yes $destination_host tar xf - -C /data/ --transform '" . 's,^.\*/data/,,' . "' --dereference"; 
+#    my $command = "tar cf - --ignore-failed-read --dereference --files-from=${transfer_filelist} | /usr/projects/cosmo/amd6100/bin/ssh -o NoneSwitch=yes -o NoneEnabled=yes $destination_host tar xf - -C /data/ --transform '" . 's,^.\*/data/,,' . "' --dereference"; 
+    my $command = "rsync -Lpt -e '/usr/projects/cosmo/amd6100/bin/ssh -o NoneSwitch=yes -o NoneEnabled=yes' --files-from=${transfer_filelist} ${local_tmp} ${destination_host}:/";
     print STDERR "$command\n";
 
@@ -118,5 +123,4 @@
 	run(command => $command, verbose => $verbose);
     unless ($success) {
-
 	print STDERR "ERROR:  $error_code\n";
 # 	my $std = join "\n", @{ $stdout_buf };
@@ -125,13 +129,13 @@
 # 	print "STDERR: $std\n";
 
-	foreach my $line (@{ $stderr_buf }) {  # This is a hack.  A messy ugly hack.
-	    if ($line =~ /No such file or directory/) { 
-		my $file = (split /\s+/, $line)[1];
-		$file =~ s/:$//;
-		if ($file !~ /nebulous/) { next; }
-		print STDERR "Touching $file so tar can continue.\n";
-		system("touch $file");
-	    }
-	}
+# 	foreach my $line (@{ $stderr_buf }) {  # This is a hack.  A messy ugly hack.
+# 	    if ($line =~ /No such file or directory/) { 
+# 		my $file = (split /\s+/, $line)[1];
+# 		$file =~ s/:$//;
+# 		if ($file !~ /nebulous/) { next; }
+# 		print STDERR "Touching $file so tar can continue.\n";
+# 		system("touch $file");
+# 	    }
+# 	}
 
 	warn("Transfer of $transfer_filelist to $destination_host failed with error $error_code.");
