Changeset 260 for trunk/soft/ObsData/bin


Ignore:
Timestamp:
10/19/06 17:14:37 (18 years ago)
Author:
nanardon
Message:
  • add --not-done option to replay files which was not done yet
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/soft/ObsData/bin/obsdata

    r259 r260  
    3434    'plugindir=s' => \my $plugindir, 
    3535    'noreport' => \my $noreport, 
     36    'not-done' => \my $not_done, 
    3637) or pod2usage(); 
    3738 
     
    4950Use this configuration file 
    5051 
    51 =item --check 
    52  
    53 Only check config file and exit 
    54  
    5552=item -l|--logfile logfile 
    5653 
    5754Write all messages into this file 
    5855 
    59 =item -v|--verbose 
     56=item --not-done 
    6057 
    61 Increase verbosity (this does not affect log output) 
     58Replay archives already find but not extracted 
     59 
     60=item --check 
     61 
     62Only check config file and exit 
    6263 
    6364=item --dry-run 
     
    6869 
    6970Do not send mail report 
     71 
     72=item -v|--verbose 
     73 
     74Increase verbosity (this does not affect log output) 
    7075 
    7176=item --debug 
     
    8590=cut 
    8691 
    87 sub sub_interactive { 
    88     my ($oa, $oe) = @_; 
    89     for ($oe->id) { 
    90         /^do_archive$/ and do { 
    91             if ($onlyold && !$oe->test_result('archive_exists')) { 
    92                 return 0; 
    93             } 
    94             if($onlynew && $oe->test_result('archive_exists')) { 
    95                 return 0 
    96             } 
    97         }; 
    98         /^overwrite$/ && !$oe->test_result('dest_exists') and return 1; 
     92my $interactive_callback = undef; 
     93 
     94if ($not_done) { 
     95    $interactive_callback = sub  { 
     96        my ($oa, $oe) = @_; 
     97        for ($oe->id) { 
     98            /^do_archive$/ and return $oe->test_result('archive_exists') || 0; 
     99            /^overwrite$/ and return($oe->test_result('dest_exists') ? 0 : 1); 
     100            /^do_data$/ && $not_done and return !$oe->test_result('data_extracted') || 0; 
     101        } 
     102        0 
    99103    } 
    100     print $oe->message ."\n"; 
    101     foreach ($oe->list_test) { 
    102         printf("\t%s\n", $oe->test_message($_)); 
     104} 
     105 
     106if ($interactif) { 
     107    $interactive_callback = sub { 
     108        my ($oa, $oe) = @_; 
     109        for ($oe->id) { 
     110            /^do_archive$/ and do { 
     111                if ($onlyold && !$oe->test_result('archive_exists')) { 
     112                    return 0; 
     113                } 
     114                if($onlynew && $oe->test_result('archive_exists')) { 
     115                    return 0 
     116                } 
     117            }; 
     118            /^overwrite$/ && !$oe->test_result('dest_exists') and return 1; 
     119        } 
     120        print $oe->message ."\n"; 
     121        foreach ($oe->list_test) { 
     122            printf("\t%s\n", $oe->test_message($_)); 
     123        } 
     124        print "Processing ? Y/n: "; 
     125        my $res = <STDIN>; 
     126        chomp($res); 
     127        return($res =~ /^[Yy]$/ ? 1 : 0); 
    103128    } 
    104     print "Processing ? Y/n: "; 
    105     my $res = <STDIN>; 
    106     chomp($res); 
    107     return($res =~ /^[Yy]$/ ? 1 : 0); 
    108129} 
    109130 
     
    118139        printf("%-9s %s\n", sprintf("[%s]", ObsData::loglevel($_[0])), $_[1]); 
    119140    }, 
    120     interactive_callback => $interactif ? \&sub_interactive : undef, 
     141    interactive_callback => $interactive_callback, 
    121142) or do { 
    122143    warn "Can't create obsdata object\n"; 
Note: See TracChangeset for help on using the changeset viewer.