Changeset 28015

Show
Ignore:
Timestamp:
09.08.2013 13:16:06 (6 years ago)
Author:
jmt12
Message:

Add an extra option that allows me to pass in the directory to write log files to, and add extra check when copying logs (by *.*) that the log directory isn't empty

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/bin/script/hadoop_import.pl

    r27913 r28015  
    1818# 0. Init 
    1919my $collection = 'test'; 
    20 my $use_thrift = 1; 
     20my $use_thrift = 0; 
    2121my $start_thrift = 0; 
    2222my $debug = 0; 
     
    3535my $username = `whoami`; 
    3636chomp($username); 
     37my $gs_results_dir = ''; 
    3738 
    3839`rocks > /dev/null 2>&1`; 
     
    8889    $use_nfs = 1; 
    8990  } 
     91  if ($ARGV[$offset] eq '-logdir') 
     92  { 
     93    $offset++; 
     94    $gs_results_dir = $ARGV[$offset]; 
     95  } 
    9096  $offset++; 
    9197} 
     
    106112  die("Error! Collection's import directory cannot be found: " . $gs_import_dir . "\n"); 
    107113} 
    108 my $gs_results_dir = $gs_collection_dir . '/results'; 
    109 if (!-d $gs_results_dir) 
    110 { 
    111   mkdir($gs_results_dir, 0755); 
    112 } 
    113 $gs_results_dir .= '/' . time(); 
     114if ($gs_results_dir eq '') 
     115{ 
     116  $gs_results_dir = $gs_collection_dir . '/results'; 
     117  if (!-d $gs_results_dir) 
     118  { 
     119    mkdir($gs_results_dir, 0755); 
     120  } 
     121  $gs_results_dir .= '/' . time(); 
     122} 
    114123if (!-d $gs_results_dir) 
    115124{ 
     
    402411  &shellCommand('cp /tmp/greenstone/*.* ' . $gs_results_dir); 
    403412} 
    404 if (-d $gs_collection_dir . '/logs') 
     413if (-d $gs_collection_dir . '/logs' && !&dirIsEmpty($gs_collection_dir . '/logs')) 
    405414{ 
    406415  &shellCommand('cp ' . $gs_collection_dir . '/logs/*.* ' . $gs_results_dir);