IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11345


Ignore:
Timestamp:
Jan 27, 2007, 3:51:39 PM (19 years ago)
Author:
eugene
Message:

added dbname, fixed workdir

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/inject.pl

    r11293 r11345  
    1919
    2020# Parse the command-line arguments
    21 my ($outroot);
     21my ($workdir, $dbname);
    2222GetOptions(
    23     'outroot'     => \$outroot
     23    'workdir|w=s'   => \$workdir,  # working directory for output files
     24    'dbname|d=s'    => \$dbname    # Database name
    2425) or pod2usage( 2 );
    2526
    26 pod2usage( -msg => "Usage: $0 [-outroot path] (files)", -exitval => 2 ) if scalar @ARGV == 0;
     27pod2usage( -msg => "Usage: $0 [--workdir path] [--dbname dbname] (files)", -exitval => 2 ) if scalar @ARGV == 0;
    2728
    2829my $pxinject = can_run('pxinject') or die "Can't find pxinject\n";
    2930my $ppStats = can_run('ppStats') or die "Can't find ppStats\n";
    3031
    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)
     34if (! $workdir) {
     35    $workdir = File::Spec->rel2abs( "." );
    3436}
    35 my $relroot = $ipprc->convert_filename_relative( $outroot );
    3637
    3738my $num = 0;
    3839foreach my $file ( @ARGV ) {
    3940    my $absfile = File::Spec->rel2abs( $file );
    40     inject($absfile, $relroot);
     41    inject($absfile, $workdir, $dbname);
    4142    $num ++;
    4243}
     
    4748{
    4849    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;
    5052
    5153    my ( $vol, $path, $name ) = File::Spec->splitpath( $absfile );
     
    6971    }
    7072   
    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    }
    7277
    7378    my ( $success_exp, $error_code_exp, $full_buf_exp, $stdout_buf_exp, $stderr_buf_exp ) =
     
    7984   
    8085    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    }
    8189   
    8290    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.