Changeset 11345 for trunk/ippScripts/scripts/inject.pl
- Timestamp:
- Jan 27, 2007, 3:51:39 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/inject.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/inject.pl
r11293 r11345 19 19 20 20 # Parse the command-line arguments 21 my ($ outroot);21 my ($workdir, $dbname); 22 22 GetOptions( 23 'outroot' => \$outroot 23 'workdir|w=s' => \$workdir, # working directory for output files 24 'dbname|d=s' => \$dbname # Database name 24 25 ) or pod2usage( 2 ); 25 26 26 pod2usage( -msg => "Usage: $0 [- outroot path] (files)", -exitval => 2 ) if scalar @ARGV == 0;27 pod2usage( -msg => "Usage: $0 [--workdir path] [--dbname dbname] (files)", -exitval => 2 ) if scalar @ARGV == 0; 27 28 28 29 my $pxinject = can_run('pxinject') or die "Can't find pxinject\n"; 29 30 my $ppStats = can_run('ppStats') or die "Can't find ppStats\n"; 30 31 31 # if outroot is not defined, assign the current path 32 if (! $outroot) { 33 $outroot = File::Spec->rel2abs( "." ); 32 # if workdir is not defined, assign the current path 33 # XXX we need to handle relative paths for workdir (not allowed) 34 if (! $workdir) { 35 $workdir = File::Spec->rel2abs( "." ); 34 36 } 35 my $relroot = $ipprc->convert_filename_relative( $outroot );36 37 37 38 my $num = 0; 38 39 foreach my $file ( @ARGV ) { 39 40 my $absfile = File::Spec->rel2abs( $file ); 40 inject($absfile, $ relroot);41 inject($absfile, $workdir, $dbname); 41 42 $num ++; 42 43 } … … 47 48 { 48 49 my $absfile = shift; # absolute path for this file 49 my $outroot = shift; # absolute path for output directory 50 my $workdir = shift; # absolute path for output directory 51 my $dbname = shift; 50 52 51 53 my ( $vol, $path, $name ) = File::Spec->splitpath( $absfile ); … … 69 71 } 70 72 71 my $command_exp = "$pxinject -newExp -exp_id $exp -inst $instrument -telescope $telescope -imfiles 1 -workdir $outroot" ; # Command to run 73 my $command_exp = "$pxinject -newExp -exp_id $exp -inst $instrument -telescope $telescope -imfiles 1 -workdir $workdir" ; # Command to run 74 if ($dbname) { 75 $command_exp = "$command_exp -dbname $dbname"; 76 } 72 77 73 78 my ( $success_exp, $error_code_exp, $full_buf_exp, $stdout_buf_exp, $stderr_buf_exp ) = … … 79 84 80 85 my $command_imfile = "$pxinject -newImfile -exp_tag $exp_tag -class fpa -class_id fpa -uri $relfile"; # Command to run 86 if ($dbname) { 87 $command_imfile = "$command_imfile -dbname $dbname"; 88 } 81 89 82 90 my ( $success_imfile, $error_code_imfile, $full_buf_imfile, $stdout_buf_imfile, $stderr_buf_imfile ) = run( command => $command_imfile, verbose => 1 );
Note:
See TracChangeset
for help on using the changeset viewer.
