Я написал Perl-скрипт, который служит плагином в промежуточном программном обеспечении glite-CREAM.Предполагается, что скрипт просто печатает выходные данные, и эти выходные данные будут храниться и публиковаться в базе данных BDII.Скрипт выводит все переменные, которые я хочу, на экран.Один из них, называемый @Store_MPICH
, получает свое значение из другой переменной в файле конфигурации, хранящемся в каталоге.Он не публикуется в базе данных BDII, хотя при запуске сценария выводятся все выходные данные, включая эту переменную @Store_MPICH
.
Значение @Store_MPICH
печатается MPICH
.Я думаю, значение @Store_MPICH
исчезнет по пути.Мне может понадобиться использовать пакет и импортировать / экспортировать его, я действительно не знаю.
Результат моего сценария:
[root@helena plugin]# ./gokop
dn: GlueSubClusterUniqueID=helena.esc.rl.ac.uk,GlueClusterUniqueID=helena.esc.rl.ac.uk,mds-vo-name=resource,o=grid
GlueHostApplicationSoftwareRunTimeEnvironment: MPICH
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE_1_0
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-ABAQUS
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-ABAQUS_6_9
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-CASTEP
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-CASTEPUTILS
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-CASTEPUTILS_5_5_1
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-CASTEP_5_5_1
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY2
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY2_2_16
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY2_2_20
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY3
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY3_3_06
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-DLPOLY3_3_10
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSIAN03
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSIAN03_E_01
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSIAN09
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSIAN09_A_02
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSIAN09_B_01
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSUTILS03
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSUTILS03_C_02
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSUTILS09
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-GAUSSUTILS09_A_02
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-IDL
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-IDL_7_0
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-NAMD
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-NAMD_2_6
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-NAMD_2_7b1
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-R
GlueHostApplicationSoftwareRunTimeEnvironment: NGS-UEE-R_2_6_0
Весь код:
#! /usr/bin/env perl
use warnings;
use IO::File;
use IO::Dir;
use IPC::Open3;
my $Pub_prefix = "NGS-UEE-";
my $Pub_version = "NGS-UEE_1_0";
$Siteinfo_file = "/etc/grid-security/siteinfo/site-info.def";
$Sw_env = "CE_RUNTIMEENV";
$MPICH_tag = "MPICH";
my $UEE_dir = "/usr/ngs";
exit unless -d $UEE_dir;
my @Default_tags = ();
my $Default_tags_file = "$UEE_dir" . "/default-tags";
if (-f $Default_tags_file) {
@Default_tags = map {split /\s+/} (IO::File->new($Default_tags_file)->getlines);
}
$fqdn = $ENV{CE_HOSTNAME} || (qx{/bin/hostname --fqdn} =~ m{(\S+)})[0];
$dn = "GlueSubClusterUniqueID=$fqdn,GlueClusterUniqueID=$fqdn,mds-vo-name=resource,o=grid";
my @tags = sort grep {/^[A-Z0-9]+_?/} (IO::Dir->new($UEE_dir)->read);
@Site_entries = ();
@Store_MPICH = ();
if (-f $Siteinfo_file) {
@Site_entries = (IO::File->new($Siteinfo_file)->getlines);
}
foreach $x (@Site_entries) {
if (index($x, "#") == 0) {next;} # Comments should be skipped
@line = split("=", $x);
chomp(@line);
if ($line[0] =~ /$Sw_env/i) {
chomp $line[1];
@values = split(" ", $line[1]);
chomp(@values);
foreach $y (@values) {
if ($y =~ /$MPICH_tag/i) {
@Store_MPICH = $y;
}
}
}
}
print "dn: $dn\n";
print "GlueHostApplicationSoftwareRunTimeEnvironment: @{Store_MPICH}\n";
print "GlueHostApplicationSoftwareRunTimeEnvironment: ${Pub_version}\n";
for my $t (@Default_tags, @tags) {
print "GlueHostApplicationSoftwareRunTimeEnvironment: ${Pub_prefix}$t\n";
}
print "\n";
Любая помощь приветствуется.