Index: trunk/cleanup.php
===================================================================
--- trunk/cleanup.php	(revision 27)
+++ trunk/cleanup.php	(revision 28)
@@ -197,5 +197,5 @@
    $num_try    = 0;
 write_log( "$me: fn_tarfile=$fn_tarfile" );
-   while ( ! file_exists( $fn_tarfile ) && $num_try < 3 )
+   while ( ! file_exists( $fn_tarfile )  &&  $num_try < 3 )
    {
       sleep( $secwait );
@@ -873,5 +873,5 @@
    // Figure out remote directory
    $remoteDir = sprintf( "$work_remote/$db-%06d", $requestID );
-write_log( "$me: is_us3iab=$is_us3iab  remoteDir=$remoteDir" );
+//write_log( "$me: is_us3iab=$is_us3iab  remoteDir=$remoteDir" );
 
    // Get stdout, stderr, output/analysis-results.tar
@@ -880,4 +880,11 @@
    if ( $is_us3iab == 0 )
    {
+      // For "-local", recompute remote work directory
+      $cmd = "ssh us3@$cluster.uthscsa.edu 'ls -d ~us3/lims/work/local' 2/dev/null";
+      exec( $cmd, $output, $stat );
+      $work_remote = $output[ 0 ];
+      $remoteDir   = sprintf( "$work_remote/$db-%06d", $requestID );
+write_log( "$me:  -LOCAL: remoteDir=$remoteDir" );
+
       // Figure out local working directory
       if ( ! is_dir( "$work/$gfacID" ) ) mkdir( "$work/$gfacID", 0770 );
@@ -942,5 +949,5 @@
 
    $lense = strlen( $stderr );
-   if ( $lense > 10000000 )
+   if ( $lense > 1000000 )
    { // Replace exceptionally large stderr with smaller version
       exec( "mv stderr stderr-orig", $output, $stat );
