Ignore:
Timestamp:
2013-06-04T11:08:37+12:00 (11 years ago)
Author:
jmt12
Message:

Clear out old logs, and adding more comments about what the script is doing (was stalling on disk sync due to me deleting a whole bunch of files, and I wondered what was happening)

File:
1 edited

Legend:

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

    r27495 r27530  
    8383  mkdir($gs_results_dir, 0755);
    8484}
    85 my $gs_archives_dir = $gs_collection_dir . '/archives';
    8685# - directories within HDFS
    8786#my $hdfs_input_dir = &urlCat('hdfs://' . $ENV{'HDFSHOST'} . ':' . $ENV{'HDFSPORT'}, 'user', $username, 'gsdl', 'collect', $collection, 'import');
     
    112111}
    113112# - clear out the archives regardless
    114 print " * Clearing existing archives directory for this collection... ";
     113my $gs_archives_dir = $gs_collection_dir . '/archives';
     114my $deleted_archives = 0;
    115115if (-e $gs_archives_dir)
    116116{
     117  print " * Clearing existing archives directory for this collection... ";
    117118  &shellCommand('rm -rf "' . $gs_archives_dir . '"');
     119  $deleted_archives = 1;
    118120}
    119121mkdir($gs_archives_dir, 0755);
    120122if (&hdfsTest('d', 0, $hdfs_output_dir))
    121123{
     124  if (!$deleted_archives)
     125  {
     126    print " * Clearing existing archives directory for this collection... ";
     127  }
    122128  &hdfsCommand('rmr', $hdfs_output_dir);
    123 }
     129  $deleted_archives = 1;
     130}
     131if ($deleted_archives)
     132{
     133  print "Done!\n";
     134}
     135# - watch for cached directories for Media based collections
     136my $gs_cached_dir = $gs_collection_dir . '/cached';
     137if (-e $gs_cached_dir)
     138{
     139  print " * Clearing existing cached media directory for this collection... ";
     140  &shellCommand('rm -rf "' . $gs_cached_dir . '"');
     141  print "Done!\n";
     142}
     143
    124144# - clear out any old logs
     145print " * Clearing existing logs for this collection... ";
     146my $gs_logs_dir = $gs_collection_dir . '/logs';
     147if (!&dirIsEmpty($gs_logs_dir))
     148{
     149  &shellCommand('rm ' . $gs_logs_dir . '/*.*');
     150}
    125151if (!&dirIsEmpty('/tmp/greenstone'))
    126152{
     
    136162
    137163# - flush DNS cache too, so we are playing on a level field
     164print " * Flushing disk cache... ";
    138165&shellCommand('flush_caches.pl');
    139166if ($is_rocks_cluster)
     
    141168  &shellCommand('rocks run host "flush_caches.pl"');
    142169}
     170print "Done!\n";
    143171
    144172# 3. Special case for *Server type infodbs (namely TDBServer and GDBMServer)
Note: See TracChangeset for help on using the changeset viewer.