ecaccess-webtoolkit-perl-src-6.3.1/Makedistrib.pl0100755 0000000 0000000 00000012166 14323263312 020532 0ustar000000000 0000000 #!/usr/bin/perl -w # # Makedistrib.pl: create package to be distributed. In the # Windows environment expect to find the dmake command. # # Laurent.Gougeon@ecmwf.int - 2011-09-21 # # Required libraries to run this script: # # perl -MCPAN -e "install PAR" # perl -MCPAN -e "install PAR::Packer" # perl -MCPAN -e "install Archive::Tar" # # This script must be started from the source # directory. use Cwd; use File::Path; use File::Copy; use Archive::Tar; use Archive::Zip qw( :ERROR_CODES :CONSTANTS ); # # Function to start an external command # sub execCmd($$) { my $command = $_[0]; my $expectedCode = $_[1]; print "# " . $command . "\n"; my $result = `$command 2>&1`; die "Error: $! (exit-code = $?)\n" if $expectedCode != -1 && not( $? >> 8 == $expectedCode ); print $result; return $result; } # # Where to install the ECMWF module? # my $installBase = ""; # # Set the PERL5LIB environment parameter to install the ECMWF module # in the source directory if "ecaccess-perl5" is defined. Otherwise # the module is installed in the standard directories. # if ( $ENV{'PERL5LIB'} ) { my $perl5lib = $ENV{'PERL5LIB'}; my $index = index( $perl5lib, 'ecaccess-perl5' ); if ( $index != -1 ) { my $find = quotemeta substr( $perl5lib, 0, $index ); $perl5lib =~ s/$find//g; $ENV{'PERL5LIB'} = $perl5lib . ":" . $ENV{'PERL5LIB'}; $installBase = " INSTALL_BASE=ecaccess-perl5"; } } # # Get the ECaccess version number from the current directory # name # my $cwd = getcwd(); my $version = substr $cwd, -5, length($cwd); my $make = "make"; # # Get the target system name (OS) # my $system; if ( $^O =~ /^MSWin/ ) { $system = "windows"; $make = "dmake"; } else { my $unameS = execCmd "uname -s", 0; my $unameM = execCmd "uname -m", 0; chomp($unameS); chomp($unameM); if ( $ENV{'ECACCESS_WEBTOOLKIT_PERL_TARGET_OS'} ) { $unameS = $ENV{'ECACCESS_WEBTOOLKIT_PERL_TARGET_OS'}; } $system = $unameS . "-" . $unameM; } # # Make, test and install the ECMWF module. # execCmd "perl Makefile.PL" . $installBase, 0; execCmd $make, 0; execCmd $make . " test", 0; execCmd $make . " install", 0; # # Build the package name # my $packageName = "ecaccess-webtoolkit-" . $version . "-" . $system; print "Creating package " . $packageName . "\n"; # # Clean/create the target directory # rmtree "$packageName"; mkdir "$packageName"; # # Get the list of scripts from the MANIFEST # my $scriptsList = ""; open( MANIFEST, "MANIFEST" ); while ( $record = ) { chomp($record); $scriptsList = "$scriptsList $record" if ( $record =~ m/^script/ ); } close(MANIFEST); # Runtime dependencies and options my $dependencies = "--compress=9"; # # Create the distribution # if ( $^O =~ /^MSWin/ ) { # # Process the Windows package # execCmd "pp " . $dependencies . " -M IO::Socket::SSL --output=$packageName/ecaccess-command.exe script/ecaccess-command $scriptsList", 0; # Goto the distrib directory chdir $packageName or die "Chdir failed ($packageName): $!\n"; # Create the bat files foreach ( split( / /, $scriptsList ) ) { $name = $_; if ( length($name) > 7 ) { my $scriptName = ( substr $name, 7 ); print "Create ", $scriptName, ".bat file\n"; open FILE, ">$scriptName" . ".bat" or die $!; print FILE "\@rem -------------------------------------------------------------\n"; print FILE "\@rem Helper to start the $scriptName command from the\n"; print FILE "\@rem ecaccess-command.exe file.\n"; print FILE "\@rem \n"; print FILE "\@rem Laurent.Gougeon\@ecmwf.int - 2012-02-09\n"; print FILE "\@rem -------------------------------------------------------------\n"; print FILE "\@%~dp0\\ecaccess-command.exe $scriptName %*\n"; close FILE; } } # Go back to the main directory chdir ".."; } else { # # Process the Unix packages # execCmd "pp " . $dependencies . " -M arybase -M IO::Socket::INET6 -M IO::Socket::SSL -M Pod::Text --output=$packageName/.ecaccess-command script/ecaccess-command $scriptsList", 0; # Goto the distrib directory chdir $packageName or die "Chdir failed ($packageName): $!\n"; # Create the links/copies $source = ".ecaccess-command"; foreach ( split( / /, $scriptsList ) ) { $name = $_; if ( length($name) > 7 ) { my $scriptName = substr $name, 7; print "ln ", $source, "->", $scriptName, "\n"; symlink $source, $scriptName; execCmd "./$scriptName -v", -1; } } # Go back to the main directory chdir ".."; } # # Build the list of files to distribute # @archivefiles = <$packageName/*>; # # Push the ecaccess helper # push( @archivefiles, "$packageName/.ecaccess-command" ) if ( not $^O =~ /^MSWin/ ); push( @archivefiles, "$packageName/ecaccess-command.exe" ) if ( $^O =~ /^MSWin/ ); # # Compress the distribution files # print "Packing distribution\n"; if ( not $^O =~ /^MSWin/ ) { Archive::Tar->create_archive( "$packageName" . ".tar.gz", 9, @archivefiles ) or die "Create tar.gz failed ($packageName): $!\n"; } else { # Create a Zip file my $zip = Archive::Zip->new(); # Add a directory $zip->addTree( $packageName . "/" ); # Save the Zip file unless ( $zip->writeToFileNamed( "$packageName" . ".zip" ) == AZ_OK ) { die "Create zip failed ($packageName): $!\n"; } } ecaccess-webtoolkit-perl-src-6.3.1/lib/ECMWF/ECaccess.pm0100755 0000000 0000000 00000044230 14323263312 021352 0ustar000000000 0000000 package ECMWF::ECaccess; use 5.008002; use strict; use warnings; use SOAP::Lite; use IO::Socket::SSL; use Net::HTTP; use MIME::Base64; use URI::Escape; use POSIX; # For windows use Encode::Locale; use Encode::Byte; require Exporter; our @ISA = qw(Exporter); our $VERSION = '6.3.1'; # ECaccess Version use constant VERSION => 'v6.3.1_17102022'; # Force SOAP to use the IO::Socket::SSL library! $ENV{'PERL_NET_HTTPS_SSL_SOCKET_CLASS'} = 'IO::Socket::SSL'; # Deactivate certificate verification in LWP (just in case) $ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = '0'; # De-activate the certificate verification IO::Socket::SSL::set_ctx_defaults( SSL_verify_mode => 0); # ECaccess variables my $data_channel; my $control_channel; # Http/https hostnames and ports my $http_ecaccess = ''; my $https_ecaccess = ''; # Open ECMWF command channel to ECaccess (secured with SSL) sub new() { # SOAP package to deal with reconnections! BEGIN { package My::SOAP::Lite; use SOAP::Lite; @My::SOAP::Lite::ISA = 'SOAP::Lite'; my $retry = 0; sub setRetry($) { $retry = $_[0]; } sub call { my $self = shift; return $self->SUPER::call unless @_; my $result = $self->SUPER::call(@_); return $result if $self->transport->is_success; my $try = $retry; # If retry is requested and the error is a transport layer error! while ( $try > 0 && ref($result) eq '') { warn "Failed connection (" . $try-- . " attempt(s) remaining)\n"; sleep 5; $result = $self->SUPER::call(@_); return $result if $self->transport->is_success; } # Get the error message if ( ref($result) eq '' ) { die ($self->transport->status . "\n"); } else { die ($result->faultstring . "\n"); } } } # Get the parameters my $package = shift; my $self = { retry => shift, debug => shift }; # Check if debug is requested? if ( $self->{debug} ) { eval "use SOAP::Lite +trace => 'debug';"; eval "use IO::Socket::SSL qw(debug3);"; } # Set the SSL connection retry My::SOAP::Lite::setRetry( $self->{retry} ); # Just in case the environment parameters are # not set no warnings qw(uninitialized); # Is it local? $http_ecaccess = "$ENV{'http_eccmd'}"; $https_ecaccess = "$ENV{'https_eccmd'}"; # Get it from the environment? $http_ecaccess = "$ENV{'http_ecaccess'}" if ( $http_ecaccess eq '' ); $https_ecaccess = "$ENV{'https_ecaccess'}" if ( $https_ecaccess eq '' ); # Default values if not set! $http_ecaccess = 'boaccess.ecmwf.int' if ( $http_ecaccess eq '' ); $https_ecaccess = 'boaccess.ecmwf.int' if ( $https_ecaccess eq '' ); # Init control channel $control_channel = My::SOAP::Lite->uri('http://service.client.ecmwf/xsd')->proxy( 'https://' . $https_ecaccess . '/axis2/services/ECaccessService?wsdl', timeout => 5000 ) ->on_fault( sub{} ); # Init data channel $data_channel = My::SOAP::Lite->uri('http://service.client.ecmwf/xsd')->proxy( 'http://' . $http_ecaccess . '/axis2/services/ECaccessService?wsdl', timeout => 5000 ) ->on_fault( sub{} ); return bless( {}, $package ); } # Get the Control Channel (https) sub getControlChannel() { return $control_channel; } # Get the Data Channel (http) sub getDataChannel() { return $data_channel; } # Get the HOME directory (Unix or Windows)? sub getHome() { # If HOME or USERPROFILE are not defined no warnings qw(uninitialized); # On Unix Platforms return $ENV{HOME} if $ENV{HOME}; # On Windows Platforms return $ENV{USERPROFILE} if $ENV{USERPROFILE}; # HOME is required to get/store the Certificate die "Please set your HOME first!\n"; } # Get the certificate file sub getCertificateFile() { # If ECCERT is not defined no warnings qw(uninitialized); # Authenticate with a Certificate file my $certificateFile; if ( $ENV{'ECCERT'} ) { # Defined in the ECCERT parameter $certificateFile = $ENV{'ECCERT'}; } else { # By default load the certificate from HOME $certificateFile = ( getHome() ) . "/.eccert.crt"; } return $certificateFile; } # Get the Security Token either from the Certificate or the eccert command when # local to ECMWF sub getToken() { # If ECCERT_HOME,HOME or ectrans_ecaccess are not defined no warnings qw(uninitialized); # The Certificate content my $certificateContent; if ( $ENV{'ECCERT_HOME'} ) { # Authenticate with the local eccert (ECMWF) my $eccert = "$ENV{'ECCERT_HOME'}/client/ecbin/" . ( POSIX::uname() )[0] . "/eccert"; # Check if the eccert command exists and is executable die "No valid eccert found: " . $eccert . " (please check with your administrator)\n" if ( not( -x $eccert ) ); # Are we using a specific eccmd port? (e.g. bucmd) my $ectransport_ecaccess = "$ENV{'ectransport_ecaccess'}"; $ectransport_ecaccess = '645' if ( $ectransport_ecaccess eq '' ); # Get the Certificate/Ticket from the eccert command my $command = $eccert . " -eccmdhost eccmd.ecmwf.int -eccmdport " . $ectransport_ecaccess . " -ecpass"; $certificateContent = `$command 2>&1`; die "Authentication failed with eccert (please check with your administrator)\n" if not( $? >> 8 == 0 ); chomp($certificateContent); } else { # Authenticate with a Certificate file my $certificateFile = getCertificateFile(); # Check if the Certificate exists die "No valid certificate found! (please use ecaccess-certificate-create first)\n" if not( -f $certificateFile && -T $certificateFile ); sub get_contents($) { my $in = shift; my $ret = ""; while (<$in>) { $ret .= $_; } return $ret; } # Load Certificate open CERT, $certificateFile or die "Error opening certificate file!\n"; $certificateContent = get_contents( *CERT{IO} ); close CERT; } # Login and get the Token from the Certificate return $control_channel->getTokenFromCertificate( encode_base64($certificateContent) )->result; } # Release the security token (logout) sub releaseToken($) { $control_channel->releaseToken( $_[1] ); } # Create a new ECaccess Certificate sub getCertificate($$) { my $userid = $_[1]; my $passcode = $_[2]; # Get the certificate file name my $file = getCertificateFile(); # Login and get the certificate my $certificate = decode_base64( $control_channel->createCertificate( $userid, $passcode )->result ); # Store the certificate open CERT, ">", $file or die "Error creating certificate file!\n"; chmod 0600, $file; binmode CERT; print CERT $certificate; close CERT; } # Download file (REST) sub getFileInputStream($$) { my $handle = $_[1]; # Open the socket connection my $socket = Net::HTTP->new( Host => $http_ecaccess ) || die "Can't open data connection!\n"; # Send the request $socket->write_request( GET => "/dataios?handle=" . ( uri_escape($handle) ), 'User-Agent' => "perl-ectools:" . $VERSION, 'Content-Type' => "text/xml" ); # Read the headers my ( $code, $mess, %h ) = $socket->read_response_headers; # Return the socket return $socket; } # Upload file (REST) sub writeFileOutputStream($$) { my $handle = $_[1]; my $data = $_[2]; # Open the socket connection my $socket = Net::HTTP->new( Host => $http_ecaccess ) || die "Can't open data connection!\n"; # Send the request $socket->write_request( POST => "/dataios", 'User-Agent' => "perl-ectools:" . $VERSION, 'Content-Type' => "multipart/form-data; boundary=---------------------------154328737501", "-----------------------------154328737501\r\n" . 'Content-Disposition: form-data; name="fileupload"; filename="' . ( uri_escape($handle) ) . '"' . "\r\n" . "Content-Type: application/octet-stream\r\n\r\n" . $data . "\r\n" . "-----------------------------154328737501--\r\n" ); # Read the headers my ( $code, $mess, %h ) = $socket->read_response_headers; } 1; __END__ # ECMWF::ECaccess Documentation =head1 NAME ECMWF::ECaccess - Perl extension to access the ECMWF ECaccess Web Services (or ECaccess API) =head1 SYNOPSIS What are the ECaccess Web Services? How to use it? ECaccess Authentication ECaccess Token Control Channel Data Channel Upload/Download FILEs Release Token ECaccess File System Where can I find examples? See Also =head1 DESCRIPTION ECMWF::ECaccess is a Perl module which provides access to the ECMWF ECaccess Web Services (or ECaccess API). =head1 WHAT ARE THE ECACCESS WEB SERVICES? The SOAP ECaccess API was created for developers and researchers interested in using ECMWF facilities in their applications. Developers write software programs that connect remotely to the SOAP ECaccess Service. Communication is performed via SOAP, an XML-based mechanism for exchanging typed information. Developers can issue requests to the following SOAP ECaccess Methods: =head2 Gateways Requests String getGatewayName(); Boolean gatewayIsConnected(); GatewayResponse getGateway(String token, String gateway); GatewayResponse[] getGatewayList(String token); =head2 Certificates and Tokens Requests byte[] createCertificate(String ecuser, String passcode); String getTokenFromCertificate(byte[] certificate); String getTokenFromUserPasscode(String ecuser, String passcode); OperationResponse[] getOperationList(String token); OperationResponse getOperation(String token, String operationName); Boolean releaseToken(String token); =head2 FILEs Requests Boolean changeFileMode(String token, Integer mode, String path); Boolean deleteFile(String token, String source, Boolean force); Boolean makeDirectory(String token, String dir); Boolean removeDirectory(String token, String dir); String getFileLastModified(String token, String source); Long getFileSize(String token, String source); Boolean copyFile(String token, String source, String target, Boolean erase); Boolean moveFile(String token, String source, String target); DirResponse[] getDirList(String token, String path, Boolean dir); String getInputFileHandle(String token, String source, Long offset); String getOutputFileHandle(String token, String target, Long offset, Integer umask); String getTemporaryFile(String token); =head2 JOBs Requests String getJobOutputHandle(String token, String jobid); String getJobInputHandle(String token, String jobid); String getJobErrorHandle(String token, String jobid); JobResponse getJob(String token, String jobid); JobResponse[] getJobList(String token); Boolean deleteJob(String token, String jobid); String submitJob(String token, JobRequest request); String restartJob(String token, String jobId); QueueResponse[] getQueueList(String token); QueueDetailResponse[] getQueueDetail(String token, String queueName); =head2 Events Requests EventResponse[] getEventList(String token); EventResponse getEvent(String token, String eventId); Integer sendEvent(String token, EventRequest request); =head2 ECtrans Associations Requests AssociationResponse[] getAssociationList(String token,String gateway); AssociationResponse getAssociation(String token, String gateway, String name, Boolean template); Boolean putAssociation(String token, String gateway, AssociationRequest association); Boolean deleteAssociation(String token, String gateway, String name); =head2 ECtrans Transfers Requests TransferResponse[] getTransferList(String token); TransferResponse getTransfer(String token, String transferId); Boolean deleteTransfer(String token, String transferId); String requestTransfer(String token, TransferRequest request); Boolean restartTransfer(String token, TransferRequest request, String transferId); =head2 IOs Requests (on FILEs and JOBs transfers) Boolean writeStringHandle(String handle, String string); Boolean writeBytesHandle(String handle, byte[] bytes); String readStringHandle(String handle, Integer size); byte[] readBytesHandle(String handle, Integer size); Boolean closeHandle(String handle); =head2 CosInfo Request String getCosInfo(String token); The following link provides the WSDL file you can use to generate code if your environment supports it: http://boaccess.ecmwf.int/axis2/services/ECaccessService?wsdl =head1 HOW TO USE IT? =head2 ECaccess Authentication Using the ECMWF::ECaccess Module requires a valid certificate. Certificates can be created with the "ecaccess-certificate-create" command from an ECMWF user identifier and a PASSCODE (using a security token), it generates a certificate in ".eccert.crt" in the user's home directory. You need to ensure the following environment parameters are set with the correct values: http_ecaccess=gateway.meteo.ms:9080 https_ecaccess=gateway.meteo.ms:9443 (e.g. if your local ECaccess Gateways name is "gateway.meteo.ms" and you are using the default ECaccess http/s ports 9080/9443) The default values are pointing to the boaccess.ecmwf.int server. If you access your ECaccess Gateway through a proxy then you should also set the following: http_proxy=http://proxy.meteo.ms:port https_proxy=https://proxy.meteo.ms:port =head2 ECaccess Token You should generally request a token for the majority of methods available. For example, if your application requires submitting a new job, you should usually request a token from your certificate which grants access to the jobs management methods (e.g. submitJob, getJobList, deleteJob or getJobResult). When you obtain an ECacces Token for a user, you must use that ECaccess Token for all future interactions with the API on behalf of the user. In order to obtain an ECaccess Token you must use the following code: use ECMWF::ECaccess; my $ecaccess = ECMWF::ECaccess->new(); # Create the ECaccess Controler my $token = $ecaccess->getToken(); # Get an ECaccess Token =head2 Control Channel Once you have an ECaccess Token you must request a Control Channel to access the API: my $controlChannel = $ecaccess->getControlChannel(); # Get the Control Channel This Control Channel will allow you to call any method of the API. For example, let's move a FILE from ECfs to the super-computer: controlChannel->moveFile($token,'ec:test/a.out','c2a:/c2a/tmp/systems/syi/a.out'); Or let's get the CosInfo from ECMWF: print $controlChannel->getCosInfo($token)->result."\n"; =head2 Data Channel In order to Download/Upload Data to/from ECMWF you are required to use a Data Channel: my $dataChannel = $ecaccess->getDataChannel(); # Get the Data Channel The methods available on the Data Channel are the following: Boolean writeStringHandle(String handle, String string); Boolean writeBytesHandle(String handle, byte[] bytes); String readStringHandle(String handle, Integer size); byte[] readBytesHandle(String handle, Integer size); =head2 Upload/Download FILEs Suppose you want to Upload a text FILE you would do the following: $handle = $controlChannel->getOutputFileHandle($token,'home:/test.txt',0,600)->result; open FILE, 'test.txt' or die $!; while (read(FILE, $data, 524288) > 0) { $dataChannel->writeStringHandle($handle,$data); } $controlChannel->closeHandle($handle); close FILE; In order to Download a binary FILE you would do the following: $handle = $controlChannel->getInputFileHandle($token,'home:/a.out',0)->result; open FILE, ">", $target or die $!; binmode FILE; while (length($data = decode_base64($dataChannel->readBytesHandle($handle, 524288)->result)) > 0) { print FILE $data; } $controlChannel->closeHandle($handle); close FILE; In both cases you get a FILE Handle through the Control Channel and then you access the Data through the Data Channel. Once the Download/Upload is completed you close the Handle with the 'closeHandle' method. =head2 Release Token Once you have finished with your session you must release your token using the following code: $ecaccess->releaseToken($token); # Logout Please note that you can also use the Control Channel to Download/Upload Data if you require a secure connection for Data Transfers (https vs. http). =head2 ECaccess File System When accessing FILEs at ECMWF the following domains are available to the user logged-in: HOME: the $HOME directory (home:) SCRATCH: the $SCRATCH directory (scratch:) ECFS: the ECFS directory (ec:) ECTMP: the ECTMP directory (ectmp:) HOST: any server at ECMWF ({host-name}:) The format of the path is the following: [domain:][/user-id/]path If no user-id is specified then the current user-id is selected by default. The user-id parameter is not valid with the HOST domain. If no domain is specified then an absolute path will translate to an absolute path on the ecgate server and a relative path will translate to a path in the HOME directory of the current user. A few examples: "bin/a.out" a.out file in the $HOME/bin directory of the current user "home:bin/a.out" a.out file in the $HOME/bin directory of the current user "/tmp/a.out" a.out file in the /tmp directory on ecgate "home:/syi/bin/a.out" a.out file in the $HOME/bin directory of user syi "ec:bin/a.out" a.out file in the ECFS bin directory of the current user "ec:/syi/bin/a.out" a.out file in the ECFS bin directory of user syi "c2a:/c2a/tmp/systems/syi/a.out" a.out file in the /c2a/tmp/systems/syi/ directory of c2a =head1 WHERE CAN I FIND EXAMPLES? The scripts which are provided along with this Module are good examples of what can be achieved with the ECMWF::ECacces Module. They use all the methods available through the ECaccess API and show the options available as well as the format of the messages which are return by the server. =head1 SEE ALSO The ECMWF::ECaccess Module is based on the SOAP-Lite Module and therefore you might be interested in looking at the documentation related to this Module: http://www.soaplite.com/ The Server Side is based on Apache Axis2 (part of the ECaccess Gateway). Documentation is also available at the following place: http://ws.apache.org/axis2/ If you have questions please contact: ecaccess@ecmwf.int To download the latest ECMWF::ECaccess Perl Module please go to: http://www.ecmwf.int/services/ecaccess/download/ =head1 AUTHOR Laurent Gougeon, ELaurent.Gougeon@ecmwf.intE =head1 COPYRIGHT AND LICENSE Copyright (C) 2010 by ECMWF (Laurent.Gougeon@ecmwf.int) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess0100755 0000000 0000000 00000027067 14323263312 020745 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess: Display ECaccess Information # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0 ); GetOptions( \%opt, qw( version ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); # Display documentation pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ); __END__ =head1 NAME ECaccess Tools (ECTools) - The ECaccess Tools gives Member States (in the following "Member States" (MS) includes "Co-operating States") and other ECMWF users batch access to the ECMWF computing and archiving facilities for the management of files, file transfers and jobs. Access is available via the Internet as well as via RMDCN. =head1 AUTHENTICATION =head2 ECaccess Certificate Using the ECaccess Tools requires a valid ECaccess Certificate. The ECaccess Certificate is a standard X509 digital Certificate saved on the user's computer as a file. It identifies a user to the ECaccess Gateway. The ECaccess Certification Authority (ECCA) signs each Certificate. Therefore, when a user provides his Certificate to the gateway, its signature is checked using the ECCA public key for verification. The ECaccess certificate is by default valid for 7 days for all services. The ECaccess Tools are also available at ECMWF. As you have already been validated to enter ECMWF, you will not need a Certificate when using these ECaccess shell commands localy. =head2 Creating a Certificate The ECaccess Certificate must be stored in the "$HOME/.eccert.crt" file and can be created with one of the following method (both methods requires an ECMWF user identifier and token PASSCODE): =head3 Using the "ecaccess-certificate-create" command: Please refer to the man page of the command for more details. =head3 Using the Web interface: Login to the Web server and in the menu click the "Get Certificate" option to download the new ECaccess Certificate. =head1 ECACCESS FILE SYSTEM When accessing FILEs at ECMWF through the ECtools, the following domains are available: HOME: the $HOME directory (home:) SCRATCH: the $SCRATCH directory (scratch:) ECFS: the ECFS directory (ec:) ECTMP: the ECTMP directory (ectmp:) HOST: any server at ECMWF ({host-name}:) =head2 Path The format of the path is the following: "[domain:][/user-id/]path" If no user-id is specified then the current user-id is selected by default. The user-id parameter is not valid with the HOST domain. If no domain is specified then an absolute path will translate to an absolute path on the ecgate server and a relative path will translate to a path in the HOME directory of the current user. =head2 Exemples "bin/a.out" a.out file in the $HOME/bin directory of the current user "home:bin/a.out" a.out file in the $HOME/bin directory of the current user "/tmp/a.out" a.out file in the /tmp directory on ecgate "home:/xyz/bin/a.out" a.out file in the $HOME/bin directory of user xyz "ec:bin/a.out" a.out file in the ECFS bin directory of the current user "ec:/xyz/bin/a.out" a.out file in the ECFS bin directory of user xyz "c1a:/c1a/tmp/systems/xyz/a.out" a.out file in the /c1a/tmp/systems/xyz/ directory of c1a =head2 Commands In the DESCRIPTION section you will find the FILEs commands which can be used to manage the files at ECMWF. Whenever a parameter or an option refer to an ECaccess File then the "[domain:][/user-id/]path" syntax apply. =head1 ECTRANS ECtrans refers to unattended file transfers initiated from ECMWF. ECtrans allows transfering files between ECMWF and remote sites. Like the UNIX "rcp" command, ECtrans requires no password to be specified on the command line for the remote host: the ECaccess gateway performs the security checking. Unlike standard FTP, ECtrans is suitable for unattended file transfers in scripts, cron jobs, etc., as it avoids the problems inherent in storing passwords in text files and sending passwords across networks. Even if you don't have a local gateway installed, you can benefit from ECtrans by using the ECMWF ECaccess gateway. Please note that in this case the transfer is not as secured as when a Member State ECaccess gateway is used. =head2 Target location Users who wish to transfer files between ECMWF and Member State servers need to declare one or more remote Member State users (msuser association) for the storage/retrieval of the remote file. This can be done through the ECaccess Web interface of the target gateway. For every "msuser" declaration, the hostname and the login username and password need to be specified. After the ECaccess gateway installation, the Member State ECaccess system administrator can customise the access methods for file transfers. These will be displayed through the ECaccess Web interface. Several schemes can be implemented, such as: B<1> - The target directory for a particular destination is a sub-directory of a central directory configured by the administrator, with the sub-directory name matching the msuser name. B<2> - The target directory for all file transfers to a given destination is a sub-directory of the msusers home directory. The administrator configures the sub-directory name. B<3> - The target directory for a given destination is configurable by the user. The administrator determines whether or not the user is allowed to include ".." in the directory path. Target directories can be located on: B<1> - Member State servers running a standard FTP service accessible from the ECaccess gateway. This is known as a "genericFtp" destination and is the most convenient way of getting the files to the system you want, under the specified user ID. B<2> - The server running the ECaccess gateway. This is known as a "genericFile" destination. All users will share in a common directory the files transferred using this destination. B<3> - Member State servers running a proprietary application. The administrator provides ectrans with the implementation of the access protocol. The administrator can also use more complex rules to define special target locations for ECMWF users, Member State users or groups of Member State users. The command "ectinfo" described in the next section can be used to get the translated URL of a target location, giving a Member State user identifier and a destination name (passwords are displayed as ***). =head2 Commands In the DESCRIPTION section you will find the ECtrans Association and Transfer Management commands which can be used to manage the ECtrans Associations and associated Transfers. =head1 EVENTS ECMWF maintains some notifications (events) which are linked to ECMWF's operational activity and offers the service for time-critical jobs. This service is also available to MS users who maintain their own notifications and can therefore create simple dependencies between different activities, at ECMWF and remote sites. =head2 Commands In the DESCRIPTION section you will find the Events Management commands which can be used to manage such Events. =head1 DESCRIPTION The ECaccess Tools are organized under nine categories covering access to the whole computing and archiving facilities of ECMWF. Each command is documented with its own man page which provide explanation as well as examples on how to use it. The following options are common to all the ECtools: =over 8 =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head2 Shell commands for certificate management (ecaccess-certificate-*) ecaccess-certificate-create - Create Certificate for the ECtools ecaccess-certificate-list - List Available Operations =head2 Shell commands for file management (ecaccess-file-*) ecaccess-file-chmod - Change ECaccess File Mode Bits ecaccess-file-copy - Copy an ECaccess File ecaccess-file-delete - Remove an ECaccess File ecaccess-file-dir - List ECaccess Directory Contents ecaccess-file-get - Download an ECaccess File ecaccess-file-mdelete - Delete Multiple ECaccess Files at once ecaccess-file-mget - Download Multiple ECaccess Files at once ecaccess-file-mkdir - Make a Directory on the ECaccess File System ecaccess-file-modtime - Show the Last Modification Time of an ECaccess File ecaccess-file-move - Move or Rename ECaccess Files ecaccess-file-mput - Upload Multiple Local Files on the ECaccess File System at once ecaccess-file-put - Upload a File on the ECaccess File System ecaccess-file-rmdir - Remove a Directory on the ECaccess File System ecaccess-file-size - Show the Size of an ECaccess File =head2 Shell commands for batch job management (ecaccess-job/queue-*) ecaccess-job-delete - Delete an ECaccess Job ecaccess-job-get - Download a Job Output/Input/Error File ecaccess-job-list - List all ECaccess Jobs ecaccess-job-restart - Restart an ECaccess Job ecaccess-job-submit - Submit a new ECaccess Job ecaccess-queue-list - List available queues =head2 Shell commands for management of events at ECMWF (ecaccess-event-*) ecaccess-event-list - List available events ecaccess-event-send - Trigger an ECaccess Event =head2 Shell commands for management of ECtrans Associations (ecaccess-association-*) ecaccess-association-delete - Delete Association ecaccess-association-get - Get the Association Descriptive File ecaccess-association-list - List your ECtrans associations ecaccess-association-protocol- List the supported ECtrans Protocol ecaccess-association-put - Update/Create an Association =head2 Shell commands for management of ECtrans Transfers (ecaccess-ectrans-*) ecaccess-ectrans-delete - Delete ECtrans ecaccess-ectrans-list - List all ectrans transfers ecaccess-ectrans-request - Request a new ECtrans transfer ecaccess-ectrans-restart - Restart an existing ECtrans transfer =head2 Shell commands for getting ECaccess Gateways information (ecaccess-gateway-*) ecaccess-gateway-list - List the ECaccess Gateways ecaccess-gateway-name - Display the name of the default ECaccess Gateway ecaccess-gateway-connected - Display the ECaccess Gateway Connection Status =head2 Shell commands for general information at ECMWF ecaccess-cosinfo - Display ConsInfo from ECMWF =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-association-delete0100755 0000000 0000000 00000006354 14323263312 024513 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-association-delete: Delete Association # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( gateway => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $associationName = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No association-name specified!\n" ) if not($associationName); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If no Gateway is specified then use the default Gateway $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} ); # Delete the association $controlChannel->deleteAssociation( $token, $opt{gateway}, $associationName ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-association-delete - Delete Association =head1 SYNOPSIS B B IB<]> I =head1 DESCRIPTION Allow deleting an ECtrans Association. Once deleted the Association can not be retrieved. The History associated with this Association will also be removed from the ECaccess Gateway Database. =head1 ARGUMENTS =over 8 =item I The name of the Association to delete. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the name of the ECaccess Gateway where the Association is installed. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I I Remove the I Association on the I Gateway. B I Remove the I Association on the default Gateway. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-association-get0100755 0000000 0000000 00000022445 14323263312 024027 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-association-get: Get the Association Descriptive File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( gateway => undef, template => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s template version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $associationName = $ARGV[0]; my $targetFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No association-name specified!\n" ) if not($associationName); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-file specified!\n" ) if not($targetFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If no Gateway is specified then use the default Gateway $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} ); # Open the target file open FILE, ">", $targetFile or die "Error creating file: " . $targetFile . "\n"; chmod 0600, $targetFile; # Get the detail for the specified associationName my $association = $controlChannel->getAssociation( $token, $opt{gateway}, $associationName, $opt{template} ? 'true' : 'false' )->valueof('//getAssociationResponse/return'); # Print the parameters print FILE "##############################################################\n"; print FILE "# Main Parameters\n"; print FILE "##############################################################\n"; print FILE "\$name='" . ( $association->{name} ) . "';\n"; print FILE "\$active='" . ( $association->{active} eq 'true' ? 'yes' : 'no' ) . "';\n"; print FILE "\$comment='" . $association->{comment} . "';\n"; print FILE "\$grantedUserList='" . $association->{grantedUserList} . "';\n"; print FILE "\$directory='" . $association->{directory} . "';\n"; print FILE "\$hostName='" . $association->{hostName} . "';\n"; print FILE "\$login='" . $association->{login} . "';\n"; print FILE "\$protocol='" . $association->{protocol} . "';\n"; print FILE "\n"; print FILE "##############################################################\n"; print FILE "# Data\n"; print FILE "##############################################################\n"; print FILE "\$data='\n" . $association->{data} . "';\n"; # Close file close FILE; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-association-get - Get the Association Descriptive File =head1 SYNOPSIS B B IB<] [-template]> I I =head1 DESCRIPTION Get the Descriptive File for the ECtrans Association specified by the I parameter. Once downloaded, the I can be modified and processed through the B command. When using the B<-template> option, if the Association already exists in the ECaccess Gateway Database, then the command return with an error. In order to create a new Association similar to an existing one the B command can be used to retrieve the Descriptive File of the existing Association. The file can then be updated and pushed to the ECaccess Gateway Database with the B command. An ECtrans Association Descriptive File contains parameters for ECtrans of the general form $name='value'. Each ECtrans Association has their own Descriptive File, and parameters in any given Descriptive File will be passed to the ECtrans container whenever a transfer is requested to the corresponding Association. Blank lines and leading spaces and tabs are ignored when they do not occur in single quoted strings. Lines whose first non-space character is a pound-sign (#) are comments, and are ignored. Note that comments are not allowed on the same line as parameters and don't persist when the Descriptive File is retrieved from the Gateway (they might however be used when Descriptive Files are archived on your system). The parameters are the following: =over 8 =item I This is a boolean which indicate if the Association can be used by ECtrans or not (e.g. 'yes' or 'no'). You might want to deactivate an Association but still keep it in the ECaccess Gateway Database for later. =item I This is a comment about your Association (e.g. 'Access to the archive system'). =item I This is the list of ECMWF user identifiers which are allowed (other that you) to use this Association. Multiple users should be separated by a column (e.g. 'abc,def,ghi'). =item I This is the directory where to download/upload the files from/to (e.g. '/tmp/data'). =item I This is the name of the host to connect to (e.g. 'hostname.example.ms'). =item I This is the login to use to connect to the host specified in the I parameter (e.g. 'anonymous'). =item I This is the protocol ECtrans will use to connect to the host specified in the I parameter. The list of available protocols for a Gateway can be displayed with the B command (e.g. 'genericFtp'). =item I This parameter can be split over multiple lines and contains various options for the I which have been selected for the Association (these options are passed verbatim to the Module which implement the I). In order to get the list of available options for a protocol please use the command B with the name of the B. The availabe options depends of the version of the ECaccess Gateway which is used to host the Association so it might be that some options are available for some Gateways and not available for others. An unknown option will be silently ignored by ECtrans. The format of an option is {protocol-shortname}.{option}={value} (e.g. ftp.port="21" would set the port option of the genericFtp module to "21"). An example of this parameter is given in the EXAMPLES section below. =back =head1 ARGUMENTS =over 8 =item I The name of the Association to retrieve the corresponding Descriptive File. =item I The name of the file where to download the Descriptive File. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the name of the ECaccess Gateway where the Association is installed. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-template> Allow creating a new Association Descriptive File for the B command. If the Association already exists then the command fails. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I I<./test> Create a new Association Descriptive File for an Association named I and store it in your current directory (file I<./test>). The file can then be edited and updated accordingly to your requirements. B I<./test> Create the Association with the previously updated I<./test> Association Descriptive File. B I I I<./ginko> Get the Descriptive File for the existing I Association on the I Gateway. B I I<./ginko> Push the Association back (once updated). This is an example of an Association Descriptive File: ############################################################## # Main Parameters ############################################################## $active='yes' $comment='Access to the archive system' $grantedUserList='abc,def,jhi' $directory='/tmp/data' $hostName='hostname.example.ms' $login='anonymous' $protocol='genericFtp' ############################################################## # Data ############################################################## $data=' ftp.mkdirs="yes" ftp.passive="no" ftp.port="21" ftp.suffix=".tmp" ftp.usetmp="yes"' Please note the multiple lines in the I parameter. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-association-list0100755 0000000 0000000 00000010167 14323263312 024221 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-association-list: List your ECtrans Associations # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( gateway => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $associationName = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If no Gateway is specified then use the default Gateway $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} ); if ( not($associationName) ) { # Get the list of associations my $associations = $controlChannel->getAssociationList( $token, $opt{gateway} ); # Display the information for each association foreach $association ( $associations->valueof('//getAssociationListResponse/return') ) { printf "%-20s %-20s %-10s %s\n", $association->{name}, $association->{hostName}, ( $association->{active} eq 'true' ? 'active' : 'not-active' ), $association->{comment}; } } else { # Get the detail for the specified associationName my $association = $controlChannel->getAssociation( $token, $opt{gateway}, $associationName )->valueof('//getAssociationResponse/return'); print " Name: " . $association->{name} . "\n"; print " Owner: " . $association->{owner} . "\n"; print " Active: " . ( $association->{active} eq 'true' ? 'yes' : 'no' ) . "\n"; print " Comment: " . $association->{comment} . "\n"; print "Directory: " . $association->{directory} . "\n"; print "Host Name: " . $association->{hostName} . "\n"; print " Login: " . $association->{login} . "\n"; print " Protocol: " . $association->{protocol} . "\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-association-list - List your ECtrans Associations =head1 SYNOPSIS B B IB<] [>IB<]> =head1 DESCRIPTION List all your ECtrans Associations. When an I is specified then the details for this Association is displayed. =head1 ARGUMENTS =over 8 =item I (optional) The name of the Association to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the name of the ECaccess Gateway where the Associations are installed. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List all your Associations on your default Gateway. B I I List the details of the Association I on the I Gateway. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-association-protocol0100755 0000000 0000000 00000010154 14323263312 025103 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-association-protocol: List the supported ECtrans Protocols # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( gateway => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $protocolName = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If no Gateway is specified then use the default Gateway $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} ); if ( not($protocolName) ) { # Get the list of protocols my $protocols = $controlChannel->getAssociationProtocolList( $token, $opt{gateway} ); # Display the information for each protocol foreach $protocol ( $protocols->valueof('//getAssociationProtocolListResponse/return') ) { printf "%-20s %-20s %-10s %s\n", $protocol->{name}, $protocol->{module}, ( $protocol->{active} eq 'true' ? 'active' : 'not-active' ), $protocol->{comment}; } } else { # Get the detail for the specified protocolName my $protocol = $controlChannel->getAssociationProtocol( $token, $opt{gateway}, $protocolName )->valueof('//getAssociationProtocolResponse/return'); print " Name: " . $protocol->{name} . "\n"; print "Shortname: " . $protocol->{module} . ( $protocol->{activeModule} eq 'true' ? '' : ' (disabled)' ) . "\n"; print " Active: " . ( $protocol->{active} eq 'true' ? 'yes' : 'no' ) . "\n"; print " Comment: " . $protocol->{comment} . "\n"; print " Archive: " . $protocol->{archive} . "\n"; print " Value: " . $protocol->{value} . "\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-association-protocol - List the supported ECtrans Protocols =head1 SYNOPSIS B B IB<] [>IB<]> =head1 DESCRIPTION List all the ECtrans Protocols supported. When a I is specified then the details for this Protocol are displayed. =head1 ARGUMENTS =over 8 =item I (optional) The name of the ECtrans Protocol to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the name of the ECaccess Gateway where to list the ECtrans Protocols supported. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List all the ECtrans Protocols supported on your default Gateway. B I I List the details/options of the Protocol I on the I Gateway. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-association-put0100755 0000000 0000000 00000012461 14323263312 024055 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-association-put: Update/Create an Association # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; use File::Basename; use Cwd 'abs_path'; my %opt = ( gateway => undef, password => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s password version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $sourceFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-file specified!\n" ) if not($sourceFile); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Source-file is not a plain text file!\n" ) if not( -f $sourceFile && -T $sourceFile ); # Prompt for a new password if required my $password = ''; if ( $opt{password} ) { print "New password: "; ReadMode('noecho'); $password = ; ReadMode('normal'); chomp($password); print "\n"; } # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If no Gateway is specified then use the default Gateway $opt{gateway} = $controlChannel->getGatewayName()->result if ( not $opt{gateway} ); # Load/check configuration from file no warnings qw(once); unless ( $return = do( abs_path($sourceFile) ) ) { die "Couldn't process $sourceFile: $@\n" if $@; die "Couldn't process $sourceFile: $!\n" unless defined $return; die "Couldn't process $sourceFile\n" unless $return; } # Update the association $controlChannel->putAssociation( $token, $opt{gateway}, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'name' => $name ), SOAP::Data->name( 'password' => $password ), SOAP::Data->name( 'active' => $active eq 'yes' ? 'true' : 'false' ), SOAP::Data->name( 'comment' => $comment ), SOAP::Data->name( 'grantedUserList' => $grantedUserList ), SOAP::Data->name( 'data' => $data ), SOAP::Data->name( 'directory' => $directory ), SOAP::Data->name( 'hostName' => $hostName ), SOAP::Data->name( 'protocol' => $protocol ), SOAP::Data->name( 'login' => $login ) ) ) ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-association-put - Update/Create an Association =head1 SYNOPSIS B B IB<] [-password]> I =head1 DESCRIPTION Allow updating or creating an ECtrans Association. If the name exists then the Association is updated. If it does not exists then a new Association is created. In order to get a template for a new Association please use the following command: B I I The I for the Association Descriptive File does not have to be the name of the Association itself. The name for the Association is specified in the I parameter. When creating a new Association the B<-password> option should be used to set the password (it can not be set in the Association Descriptive File as this would not be secure). =head1 ARGUMENTS =over 8 =item I The name of the Association Descriptive File to upload. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the name of the ECaccess Gateway where the Association should be installed. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-password> Allow prompting for a new password for the Association. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<./test> Push the Association described in the I<./test> file of your current directory on your default Gateway. You will be also prompted for a new password. B I I<./test> Push the Association described in the I<./test> file of your current directory on the I Gateway. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-certificate-create0100755 0000000 0000000 00000005177 14323263312 024464 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-certificate-create: Create Certificate for the ECtools # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); my $userid = $ARGV[0]; # Get the userid if not specified if ( not($userid) ) { print "Please enter your user-id: "; $userid = ; chomp($userid); } # Get the passcode print "Your passcode: "; ReadMode('noecho') if ( -t STDIN && -t STDOUT ); my $passcode = ; ReadMode('normal') if ( -t STDIN && -t STDOUT ); chomp($passcode); print "\n"; # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Create the certificate $ecaccess->getCertificate( $userid, $passcode ); __END__ =head1 NAME ecaccess-certificate-create - Create Certificate for the ECtools =head1 SYNOPSIS B BIB<]> =head1 DESCRIPTION This command allow creating a Certificate with your ECMWF User Identifier and Security Token. The Certificate is required to use the ECtools. It is stored in your home directory ($HOME/.eccert.crt). If you don't specify your ECMWF User Identifier on the command-line then you will be prompted for it. =head1 ARGUMENTS =over 8 =item I (optional) The ECMWF User Identifier to use. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Create a new ECaccess Certificate for the ECMWF User Identifier I and store it in the "$HOME/.eccert.crt" File. =head1 SEE ALSO B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-certificate-list0100755 0000000 0000000 00000006713 14323263312 024171 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-certificate-list: List Available Operations # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); my $operationname = $ARGV[0]; # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($operationname) ) { # Get the list of operations my $operations = $controlChannel->getOperationList($token); # Display the information for each operation foreach $operation ( $operations->valueof('//getOperationListResponse/return') ) { printf "%-20s %-8s %-20s %-20s\n", $operation->{name}, $operation->{duration}, $operation->{endDate}, $operation->{comment}; } } else { # Get the information for the specified operation $operation = $controlChannel->getOperation( $token, $operationname )->valueof('//getOperationResponse/return'); print " Operation name: ", $operation->{name}, "\n"; print "Standard Validity: ", $operation->{standard}, "\n"; print " Your Validity: ", $operation->{duration}, "\n"; print " Start Date: ", $operation->{startDate}, "\n"; print " End Date: ", $operation->{endDate}, "\n"; print " Comment: ", $operation->{comment}, "\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-certificate-list - List Available Operations =head1 SYNOPSIS B BIB<]> =head1 DESCRIPTION List all the Operations which are available with the current Certificate (the one in your "$HOME/.eccert.crt" File). If a required Operation is expired then you should renew your Certificate with the B command. If you specify an I on the command-line then the information for this Operation only will be displayed. =head1 ARGUMENTS =over 8 =item (optional) The name of the Operation to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List all the Operations for your certificate. B I List all the details for the Operation I only. =head1 SEE ALSO B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-command0100755 0000000 0000000 00000001427 14323263312 022351 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess: Helper to start any ecaccess command from the PAR archive # # Laurent.Gougeon@ecmwf.int - 2012-02-09 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use IPC::System::Simple qw(system capture); my $commandName = $ARGV[0]; my $dataDir = $ENV{PAR_TEMP}; die "No command name specified!\n" if not($commandName); die "Not called from a PAR archive\n" if not($dataDir); # Remove command name from args shift(@ARGV); # Define the filename of the script my $command = "$dataDir\\inc\\script\\$commandName"; # Check if the command exists die "Command $commandName not found!\n" if ( not( -e $command ) ); # Run the requested ecaccess command eval { $exitCode = system( $^X, $command, @ARGV ); }; # Return exit code from command exit($exitCode); ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-cosinfo0100755 0000000 0000000 00000004000 14323263312 022361 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-cosinfo: Display ConsInfo from ECMWF # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Display the ConsInfo print $controlChannel->getCosInfo($token)->result . "\n"; # Release the Token END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-cosinfo - Display ConsInfo from ECMWF =head1 SYNOPSIS B B =head1 DESCRIPTION Cosinfo is the system used at ECMWF to provide computer operations system information, such as scheduled or unscheduled downtime of servers, applications or hardware. =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 SEE ALSO B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-ectrans-delete0100755 0000000 0000000 00000004603 14323263312 023631 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-ectrans-delete: Delete ECtrans # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ectransId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ectrans-id specified!\n" ) if not($ectransId); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the ectrans $controlChannel->deleteTransfer( $token, $ectransId ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-ectrans-delete - Delete ECtrans =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow deleting the ECtrans transfer with the I identifier from the ECtrans Spool. =head1 ARGUMENTS =over 8 =item I The identifier of the ECtrans transfer to delete. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Delete the ECtrans transfer with the identifier I<124356>. =head1 SEE ALSO B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-ectrans-list0100755 0000000 0000000 00000007607 14323263312 023351 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-ectrans-list: List all ECtrans transfers # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ectransId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($ectransId) ) { # Get the list of transfers my $transfers = $controlChannel->getTransferList($token); # Display the information for each transfer foreach $transfer ( $transfers->valueof('//getTransferListResponse/return') ) { printf "%-10s %-10s %-20s %-20s %s\n", $transfer->{transferId}, $transfer->{status}, $transfer->{ownerUserId}, $transfer->{hostName}, $transfer->{scheduledDate}; } } else { # Get the detail for the specified ectransId my $transfer = $controlChannel->getTransfer( $token, $ectransId )->valueof('//getTransferResponse/return'); print " Copyid: " . $transfer->{transferId} . "\n"; print " MS user: " . $transfer->{ownerUserId} . "\n"; print " Hostname: " . $transfer->{hostName} . "\n"; print " Status: " . $transfer->{status} . "\n"; print "Last error: " . $transfer->{lastErrorMessage} . "\n" if ( $transfer->{lastErrorMessage} ); print " Schedule: " . $transfer->{scheduledDate} . "\n"; print " Source: " . $transfer->{sourceFileName} . "\n"; print " Target: " . $transfer->{targetFileName} . "\n"; print " File size: " . $transfer->{fileSize} . "\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-ectrans-list - List all ECtrans transfers =head1 SYNOPSIS B BIB<]> =head1 DESCRIPTION List all the ECtrans transfers in the ECtrans Spool. When an I is specified then the details for this transfer are displayed. The Transfer statuses can have the following values: =over 8 =item B Files are being transferred to the spool. =item B Files are being transferred to the remote site. =item B Files are scheduled and waiting to be started. =item B File transfer will be retried. =item B Files have NOT been successfully transferred (error). =item B Files have been successfully transferred. =back =head1 ARGUMENTS =over 8 =item I (optional) The name of the ECtrans transfer to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Give the informations concerning the ECtrans transfer I<124356>. B List all the ECtrans transfers in the Spool. =head1 SEE ALSO B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-ectrans-request0100755 0000000 0000000 00000027165 14323263312 024067 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-ectrans-request: Request a new ECtrans transfer # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( gateway => undef, target => undef, mailTo => undef, retryCount => 144, retryFrequency => 600, priority => 99, lifeTime => '7d', onSuccess => 0, onFailure => 0, onRetry => 0, deleteSource => 0, keep => 0, reject => 0, append => 0, resume => 0, overwrite => 0, maximumDuration => undef, minimumDuration => undef, minimumRate => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s target=s mailTo=s retryCount=i retryFrequency=i priority=i lifeTime=s onSuccess onFailure onRetry deleteSource keep reject append resume overwrite maximumDuration=s minimumDuration=s minimumRate=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $remote = $ARGV[0]; my $source = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No remote specified!\n" ) if not($remote); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source specified!\n" ) if not($source); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryCount specified (>0)!\n" ) if not( $opt{retryCount} >= 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryFrequency specified (>0)!\n" ) if not( $opt{retryFrequency} > 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -priority specified (0-99)!\n" ) if not( $opt{priority} >= 0 && $opt{priority} <= 99 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-resume)!\n" ) if ( $opt{append} && $opt{resume} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-overwrite)!\n" ) if ( $opt{append} && $opt{overwrite} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-reject)!\n" ) if ( $opt{append} && $opt{reject} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-resume,-overwrite)\n" ) if ( $opt{resume} && $opt{overwrite} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-resume,-reject)\n" ) if ( $opt{resume} && $opt{reject} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-reject,-overwrite)\n" ) if ( $opt{reject} && $opt{overwrite} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Value for "ifTargetFileExists" option my $ifTargetFileExists = 'reject'; $ifTargetFileExists = 'append' if ( $opt{append} ); $ifTargetFileExists = 'resume' if ( $opt{resume} ); $ifTargetFileExists = 'overwrite' if ( $opt{overwrite} ); # Request for the new ECTrans $ectransId = $controlChannel->requestTransfer( $token, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'gatewayName' => $opt{gateway} ), SOAP::Data->name( 'remoteLocation' => $remote ), SOAP::Data->name( 'sourceFileName' => $source ), SOAP::Data->name( 'targetFileName' => $opt{target} ), SOAP::Data->name( 'retryCount' => $opt{retryCount} ), SOAP::Data->name( 'retryFrequency' => $opt{retryFrequency} ), SOAP::Data->name( 'priority' => $opt{priority} ), SOAP::Data->name( 'lifeTime' => $opt{lifeTime} ), SOAP::Data->name( 'maximumDuration' => $opt{maximumDuration} ), SOAP::Data->name( 'minimumDuration' => $opt{minimumDuration} ), SOAP::Data->name( 'minimumRate' => $opt{minimumRate} ), SOAP::Data->name( 'deleteSource' => $opt{deleteSource} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'keepInSpool' => $opt{keep} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'userMailAddress' => $opt{mailTo} ), SOAP::Data->name( 'sendMailOnSuccess' => $opt{onSuccess} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'sendMailOnFailure' => $opt{onFailure} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'sendMailOnRetry' => $opt{onRetry} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'ifTargetFileExists' => $ifTargetFileExists ) ) ) )->result; print $ectransId. "\n"; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-ectrans-request - Request a new ECtrans transfer =head1 SYNOPSIS B B IB<] [-target> IB<] [-retryCount> IB<] [-retryFrequency> IB<] [-priority> IB<] [-lifeTime> IB<] [-mailTo> IB<] [-onSuccess] [-onFailure] [-onRetry] [-deleteSource] [-keep] [-reject>|B<-append>|B<-resume>|B<-overwrite] [-maximumDuration> IB<] [-minimumDuration> IB<] [-minimumRate> IB<]> IB<[>I<@protocol>B<]> I =head1 DESCRIPTION Allow Member State users to initiate file transfers between ECMWF and Member State servers. The ECaccess Server will spool the ECMWF file specified by the I parameter in the user's ECtrans transfer queue: if the connection between the ECMWF and Member State gateways is down or if any error occurs, the file will be kept in the spool area at ECMWF and you can resume the transfer through the web interface or with the B command. If required the transfer can be retried automatically (see the B<-retryCount> and B<-retryFrequency> options to tailor the retry mechanism). The B<-reject>, B<-append>, B<-resume> and B<-overwrite> options are mutually exclusive and determine what to do if there is an existing target file. The B<-mailTo> option specifies an I address to be notified in case of a successful (option B<-onSuccess>) and/or a failed transfer (option B<-onFailure>). When a request has been spooled successfully, an I is returned immediately. The I can be used to reference the transfer, using the web interface or with the B, B or B commands. =head1 ARGUMENTS =over 8 =item IB<[>I<@protocol>B<]> The ECtrans Association with optionaly the name of the protocol to use. =item I Name of the file at ECMWF to spool in ECtrans. =back =head1 OPTIONS =over 8 =item B<-gateway> I This is the I of the ECaccess Gateway where the ECtrans Association I is defined. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-target> I Defines the target I (default: same as I). =item B<-retryCount> I Defines the I of retries (default: 144). =item B<-retryFrequency> I Defines the I of retries in seconds (default: 600 seconds). =item B<-priority> I Defines the transmission I 0-99 (default: 99). =item B<-lifeTime> I Defines the lifetime of the request (default: 7 days). The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<1w> or I<2d>). =item B<-mailTo> I Defines the target I address (default: @ecmwf.int). =item B<-onSuccess> Allow sending a mail when the transfer is successful. =item B<-onFailure> Allow sending a mail when the transfer has failed. =item B<-onRetry> Allow sending a mail when the transfer is retried. =item B<-deleteSource> Allow deleting the original I file once it is safe in the spool. =item B<-keep> Allow keeping the request in the spool until the duration specified in the B<-lifeTime> option has passed. By default a successful transfer is removed from the spool. =item B<-reject> Allow failing if there is an existing target file (default). =item B<-append> Allow appending if there is an existing target file. =item B<-resume> Allow resuming if there is an existing target file. =item B<-overwrite> Allow overwriting if there is an existing target file. =item B<-maximumDuration> I Define the maximum transfer I. The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<10m> or I<1h>). A value <=0 will deactivate the feature (default: 12h). =item B<-minimumDuration> I Allow setting the I before to control a transmission (e.g. for the first 10 minutes ECtrans don't try to check the transfer rate, which allow not to enforce some minimum transfer rates for very small files). The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<30s> or I<10m>). A value <=0 will deactivate the feature (default: 10m). =item B<-minimumRate> I Allow setting a minimum transfer I for a transmission (expressed in bytes/s). This is an average value, not the transmission I at one particular moment in time (e.g. if a big file is stuck for 5 minutes but then transmit much faster later on then it will not be interrupted as long as the overall transfer rate is above the minimum). A value <=0 will deactivate the feature (default: 10240). =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<2d> B<-overwrite -onFailure -onRetry> I I Request a file transfer of the I file to the default gateway with the association I and the protocol I. If the target file already exists then the original file is deleted. If the transfer is retried or fail then an email is sent to the default email address (@ecmwf.int). After 2 days the file is removed from the spool (whatever the status of the transmission is). B I<10m> B<-maximumDuration> I<35m> B<-minimumRate> I<8192> I I After 10 minutes ECtrans will start to control the transfer rate. If after 35 minutes the file is still not transmitted or if at a certain point in time the average transmission rate is less than 8Kbytes/s then the transmission will be canceled. If canceled, the transmission will be retried 144 times (with a 10 minutes interval). =head1 SEE ALSO B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-ectrans-restart0100755 0000000 0000000 00000022355 14323263312 024057 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-ectrans-restart: Restart an existing ECtrans transfer # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( gateway => undef, remote => undef, target => undef, mailTo => undef, retryCount => undef, retryFrequency => undef, priority => undef, lifeTime => undef, onSuccess => undef, onFailure => undef, onRetry => undef, keep => undef, reject => undef, append => undef, resume => undef, overwrite => undef, maximumDuration => undef, minimumDuration => undef, minimumRate => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( gateway=s remote=s target=s mailTo=s retryCount=i retryFrequency=i priority=i lifeTime=s onSuccess onFailure onRetry keep reject append resume overwrite maximumDuration=s minimumDuration=s minimumRate=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $transferId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No transfer-id specified!\n" ) if not($transferId); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryCount specified (>0)!\n" ) if $opt{retryCount} && not( $opt{retryCount} >= 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryFrequency specified (>0)!\n" ) if $opt{retryFrequency} && not( $opt{retryFrequency} > 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -priority specified (0-99)!\n" ) if $opt{priority} && not( $opt{priority} >= 0 && $opt{priority} <= 99 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-resume)!\n" ) if ( $opt{append} && $opt{resume} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-overwrite)!\n" ) if ( $opt{append} && $opt{overwrite} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options (-append,-reject)!\n" ) if ( $opt{append} && $opt{reject} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-resume,-overwrite)\n" ) if ( $opt{resume} && $opt{overwrite} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-resume,-reject)\n" ) if ( $opt{resume} && $opt{reject} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-reject,-overwrite)\n" ) if ( $opt{reject} && $opt{overwrite} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Value for "ifTargetFileExists" option my $ifTargetFileExists = undef; $ifTargetFileExists = 'reject' if ( $opt{reject} ); $ifTargetFileExists = 'append' if ( $opt{append} ); $ifTargetFileExists = 'resume' if ( $opt{resume} ); $ifTargetFileExists = 'overwrite' if ( $opt{overwrite} ); # Restart the existing ECTrans $controlChannel->restartTransfer( $token, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'gatewayName' => $opt{gateway} ), SOAP::Data->name( 'remoteLocation' => $opt{remote} ), SOAP::Data->name( 'targetFileName' => $opt{target} ), SOAP::Data->name( 'retryCount' => $opt{retryCount} ), SOAP::Data->name( 'retryFrequency' => $opt{retryFrequency} ), SOAP::Data->name( 'priority' => $opt{priority} ), SOAP::Data->name( 'lifeTime' => $opt{lifeTime} ), SOAP::Data->name( 'maximumDuration' => $opt{maximumDuration} ), SOAP::Data->name( 'minimumDuration' => $opt{minimumDuration} ), SOAP::Data->name( 'minimumRate' => $opt{minimumRate} ), SOAP::Data->name( 'keepInSpool' => defined $opt{keep} ? $opt{keep} ? 'true' : 'false' : undef ), SOAP::Data->name( 'userMailAddress' => $opt{mailTo} ), SOAP::Data->name( 'sendMailOnSuccess' => defined $opt{onSuccess} ? $opt{onSuccess} ? 'true' : 'false' : undef ), SOAP::Data->name( 'sendMailOnFailure' => defined $opt{onFailure} ? $opt{onFailure} ? 'true' : 'false' : undef ), SOAP::Data->name( 'sendMailOnRetry' => defined $opt{onRetry} ? $opt{onRetry} ? 'true' : 'false' : undef ), SOAP::Data->name( 'ifTargetFileExists' => $ifTargetFileExists ) ) ), $transferId ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-ectrans-restart - Restart an existing ECtrans transfer =head1 SYNOPSIS B B IB<] [-remote> IB<] [-target> IB<] [-retryCount> IB<] [-retryFrequency> IB<] [-priority> IB<] [-lifeTime> IB<] [-mailTo> IB<] [-onSuccess] [-onFailure] [-onRetry] [-keep] [-reject>|B<-append>|B<-resume>|B<-overwrite] [-maximumDuration> IB<] [-minimumDuration> IB<] [-minimumRate> IB<]> I =head1 DESCRIPTION Allow restarting the ECtrans transfer with the I identifier. In order to get the list of ECtrans transfers and the corresponding I please use the B command. If you want to setup an ECtrans transfer then use the B command which will give you an I (this one can be kept for a later restart). =head1 ARGUMENTS =over 8 =item I The identifier of the ECtrans transfer to restart. =back =head1 OPTIONS =over 8 =item B<-gateway> I Update the I of the ECaccess Gateway. =item B<-remote> I Update the target I in the format IB<[>I<@protocol>B<]>. =item B<-target> I Update the target I. =item B<-retryCount> I Update the I of retries. =item B<-retryFrequency> I Update the I of retries in seconds. =item B<-priority> I Update the transmission I 0-99. =item B<-lifeTime> I Update the lifetime of the transfer request. The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<1w> or I<2d>). =item B<-mailTo> I Update the target I address. =item B<-onSuccess> Allow sending a mail when the transfer is successful. =item B<-onFailure> Allow sending a mail when the transfer has failed. =item B<-onRetry> Allow sending a mail when the transfer is retried. =item B<-keep> Allow keeping the request in the spool until the duration specified in the B<-lifeTime> option has passed. By default a successful transfer is removed from the spool. =item B<-reject> Allow failing if there is an existing target file. =item B<-append> Allow appending if there is an existing target file. =item B<-resume> Allow resuming if there is an existing target file. =item B<-overwrite> Allow overwriting if there is an existing target file. =item B<-maximumDuration> I Allow updating the maximum transfer I. The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<10m> or I<1h>). A value <=0 will deactivate the feature. =item B<-minimumDuration> I Allow updating the I before to control a transmission (e.g. for the first 10 minutes ECtrans don't try to check the transfer rate, which allow not to enforce some minimum transfer rates for very small files). The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<30s> or I<10m>). A value <=0 will deactivate the feature. =item B<-minimumRate> I Allow updating the minimum transfer I for a transmission (expressed in bytes/s). This is an average value, not the transmission I at one particular moment in time (e.g. if a big file is stuck for 5 minutes but then transmit much faster later on then it will not be interrupted as long as the overall transfer rate is above the minimum). A value <=0 will deactivate the feature. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Restart the ECtrans transfer with the identifier I<124356>. =head1 SEE ALSO B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-clear0100755 0000000 0000000 00000004614 14323263312 023141 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-clear: Clear an ECaccess Event # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $eventid = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-id specified!\n" ) if not($eventid); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the event $controlChannel->clearEvent( $token, $eventid ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-clear - Clear an ECaccess Event =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow clearing the event specified by its I. Delete all the subscritions to this event and reset the sequence number. =head1 ARGUMENTS =over 8 =item I The identifier of the Event to clear. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<167> Clear the event I<167>. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-create0100755 0000000 0000000 00000007557 14323263312 023327 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-send: Create an ECaccess Event # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( comment => '', public => 0, overwrite => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( comment:s public overwrite version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $eventname = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-name specified!\n" ) if not($eventname); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Create the event my $event = $controlChannel->createEvent( $token, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'name' => $eventname ), SOAP::Data->name( 'comment' => $opt{comment} ), SOAP::Data->name( 'overwrite' => $opt{overwrite} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'isPublic' => $opt{public} ? 'true' : 'false' )->type('xsd:boolean') ) ) ); print $event->valueof('//createEventResponse/return')->{eventId}, "\n"; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-create - Create an ECaccess Event =head1 SYNOPSIS B B IB<]> I =head1 DESCRIPTION Allow creating an ECaccess Event. As a result the I is displayed. If an event already exists with the same I then by default the request is rejected (please check the B<-overwrite> option). By default an event is private and restricted to its owner. Access can however be shared with other users thanks to the B command or with the B<-public> option which make it visible to all. =head1 ARGUMENTS =over 8 =item I The name of the Event to create. =back =head1 OPTIONS =over 8 =item B<-overwrite> Allow deleting an existing event with the same name and create a new one (the identifier will be however different to the original one). =item B<-public> Allow creating a public event which can be used by everybody. In order to have a better tunning of the permissions please keep the event private and use the B command instead. =item B<-comment> I Specify the I to display as a comment for the event. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<"My Comment"> I<"My Event Name"> Create the new event with the name I<"My Event Name"> and the comment I<"My Comment">. This new event is public and other users can subscribe to it. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-delete0100755 0000000 0000000 00000005013 14323263312 023307 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-delete: Delete an ECaccess Event # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $eventid = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-id specified!\n" ) if not($eventid); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the event $controlChannel->deleteEvent( $token, $eventid ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-delete - Delete an ECaccess Event =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow deleting the event specified by its I. All the Job Subscritions to this Event will be also deleted which mean that any Job in the STDBY status will be deleted (the previous instances of these Jobs will not be affected). =head1 ARGUMENTS =over 8 =item I The identifier of the Event to delete. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<167> Delete the event I<167>. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-grant0100755 0000000 0000000 00000007265 14323263312 023173 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-grant: Grant usage of an ECaccess Event # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( subscribe => 0, notify => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( subscribe notify version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $eventid = $ARGV[0]; my $userList = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-id specified!\n" ) if not($eventid); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No users-list specified!\n" ) if not($userList); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the event $controlChannel->grantEvent( $token, $eventid, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'userList' => $userList ), SOAP::Data->name( 'subscribe' => $opt{subscribe} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'notify' => $opt{notify} ? 'true' : 'false' )->type('xsd:boolean') ) ) ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-grant - Grant usage of an ECaccess Event =head1 SYNOPSIS B B I I =head1 DESCRIPTION Allow managing the Event permissions for a list of user(s). The permissions can be either subscribe, notify, both or none. In order to remove permissions to an Event for a list of users use this command with no B<-subscribe> and B<-notify> options. =head1 ARGUMENTS =over 8 =item I The identifier of the Event to grant. =item I The user(s) to give/remove the permissions. Multiple users should be separated by a column (e.g. abc,def). =back =head1 OPTIONS =over 8 =item B<-subscribe> The user(s) specified in the I will be allowed to subscribe to the I (e.g. with the B<-eventIds> option of the B command). =item B<-notify> The user(s) specified in the I will be allowed to send notifications to the I (e.g. with the B command). =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<167> I Allow the users I, I and I to subscribe to this Event. B I<167> I Remove all rights to the Event for the user I. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-list0100755 0000000 0000000 00000007173 14323263312 023031 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-list: List available events # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); my $eventidorname = $ARGV[0]; # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($eventidorname) ) { # Get the list of events my $events = $controlChannel->getEventList($token); # Display the information for each event foreach $event ( $events->valueof('//getEventListResponse/return') ) { printf "%-10s %-20s %-40s\n", $event->{eventId}, $event->{name}, $event->{comment}; } } else { # Get the information for the specified event my $event = $controlChannel->getEvent( $token, $eventidorname )->valueof('//getEventResponse/return'); print " Event-id: ", $event->{eventId}, "\n"; print " Name: ", $event->{name}, "\n"; print " Public: ", ( $event->{isPublic} eq 'true' ? 'yes' : 'no' ), "\n"; print " Owner: ", $event->{ownerUserId}, "\n"; print " Comment: ", $event->{comment}, "\n" if $event->{comment}; print " Title: ", $event->{title}, "\n" if $event->{title}; print " Metadata: ", $event->{metadata}, "\n" if $event->{metadata}; print " Can send: ", $event->{notifyUserList}, "\n" if $event->{notifyUserList}; print "Can subscribe: ", $event->{subscribeUserList}, "\n" if $event->{subscribeUserList}; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-list - List available events =head1 SYNOPSIS B BI|IB<]> =head1 DESCRIPTION List all the ECaccess Events which are available to your ECMWF user identifier. If an I or I is specified as an argument then this command will display all the information related to this event. =head1 ARGUMENTS =over 8 =item I|I (optional) The identifier or name of the Event to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Gives the information related to the I I. B List all the events available to your ECMWF user identifier. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-event-send0100755 0000000 0000000 00000010420 14323263312 022774 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-event-send: Trigger an ECaccess Event # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( environment => undef, delay => undef, at => undef, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( environment:s delay:s at:s version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $eventid = $ARGV[0]; my $sequence = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No event-id specified!\n" ) if not($eventid); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No sequence specified!\n" ) if not($sequence); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid sequence number!\n" ) if not( ( ( $sequence * 1 ) eq $sequence ) && abs($sequence) <= 2147483647 ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Trigger the event my $updates = $controlChannel->sendEvent( $token, $eventid, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'env' => $opt{environment} ), SOAP::Data->name( 'delay' => $opt{delay} ), SOAP::Data->name( 'at' => $opt{at} ), SOAP::Data->name( 'seq' => $sequence ) ) ) )->result; print "Notification sent for ", $eventid, " (", $updates, " subscription(s) updated)\n"; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-event-send - Trigger an ECaccess Event =head1 SYNOPSIS B B IB<] [-delay> IB<] [-at> IB<]> I I =head1 DESCRIPTION Allow triggering the event specified by its I. The I number should always be greater than the last I submitted. The specified environment parameters are passed to the jobs before submissions. The triggering of the event can also be delayed or started at a later time if required. As a result the number of notification(s) updated is displayed. =head1 ARGUMENTS =over 8 =item I The identifier of the Event to trigger. =item I The sequence number for the triggering (must be an integer between 0 and 2147483647). =back =head1 OPTIONS =over 8 =item B<-environment> I Specify which environment I to pass to the jobs. Multiple variables should be separated by a semi-column (e.g. I<"PARAM1=xxx;PARAM2=yyy">). =item B<-delay> I Allow delaying the submission of the event (default: no delay). The I is specified in [w]eeks, [d]ays, [h]ours, [m]inutes or [s]econds (e.g. I<1w> or I<2d>). =item B<-at> I Specify the starting I for the event (default: immediate submission). The format of the date is "yyyy-MM-dd HH:mm" (e.g. I<"2011-01-19 12:17">). =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<167> I<2000> Trigger the event I<167> with a sequence number of I<2000>. B I<1d> I<167> I<2000> Trigger the same event as in the previous example in 24 hours. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-chmod0100755 0000000 0000000 00000006375 14323263312 022751 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-chmod: Change ECaccess File Mode Bits # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $mode = $ARGV[0]; my $ecaccessFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No mode specified!\n" ) if not($mode); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Trigger the event $controlChannel->changeFileMode( $token, $mode, $ecaccessFile ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-chmod - Change ECaccess File Mode Bits =head1 SYNOPSIS B B I I =head1 DESCRIPTION Allow changing the ECaccess File Mode Bits of the given I according to I, which is an octal number representing the bit pattern for the new mode bits. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I Octal number representing the bit pattern for the new mode bits (e.g. 0600). =item I The name of the ECaccess File to change the File Mode Bits. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<0700> I Change the File Mode Bits to Read and Write for owner and Read for everybody else on a File in the bin directory of the ECFS directory of the authenticated user. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-copy0100755 0000000 0000000 00000006620 14323263312 022622 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-copy: Copy an ECaccess File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, erase => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( erase version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $sourceECaccessFile = $ARGV[0]; my $targetECaccessFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-ecaccess-file specified!\n" ) if not($sourceECaccessFile); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-ecaccess-file specified!\n" ) if not($targetECaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Copy the file $controlChannel->copyFile( $token, $sourceECaccessFile, $targetECaccessFile, SOAP::Data->type( boolean => $opt{erase} ) ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-copy - Copy an ECaccess File =head1 SYNOPSIS B B I I =head1 DESCRIPTION Copy the I to the I. The I and I are in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The source ECaccess File name for the copy. =item I the target ECaccess File name for the copy. =back =head1 OPTIONS =over 8 =item B<-erase> Delete the source file once the copy has completed successfully. By default the source file is not deleted. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I I Copy the I File in the ECFS bin directory of the authenticated user to the "/c1a/tmp/systems/xyz" directory on c1a. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-delete0100755 0000000 0000000 00000005620 14323263312 023111 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-delete: Remove an ECaccess File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( force => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( force version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ecaccessFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the file $controlChannel->deleteFile( $token, $ecaccessFile, SOAP::Data->type( boolean => $opt{force} ) ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-delete - Remove an ECaccess File =head1 SYNOPSIS B B I =head1 DESCRIPTION Remove the I. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The name of the ECaccess File to delete. =back =head1 OPTIONS =over 8 =item B<-force> Ignore nonexistent files and complete successfully. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Remove the I File of the $SCRATCH/bin directory of the authenticated user. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-dir0100755 0000000 0000000 00000007305 14323263312 022427 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-dir: List ECaccess Directory Contents # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( long => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( long version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); my $ecaccessFile = $ARGV[0]; # If no file specified then list home directory $ecaccessFile = '' if ( not($ecaccessFile) ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # List the files my $ecaccessFiles = $controlChannel->getDirList( $token, $ecaccessFile ); # Display the information for each file foreach my $ecaccessFile ( $ecaccessFiles->valueof('//getDirListResponse/return') ) { if ( $opt{long} ) { printf "%s 1 %-8s %-8s %-11s %s %s", $ecaccessFile->{permissions}, $ecaccessFile->{user}, $ecaccessFile->{group}, $ecaccessFile->{size}, $ecaccessFile->{time}, $ecaccessFile->{name}; print " -> " . $ecaccessFile->{link} if ( $ecaccessFile->{link} ); print "\n"; } else { print $ecaccessFile->{name} . "\n"; } } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-dir - List ECaccess Directory Contents =head1 SYNOPSIS B B B<[>IB<]> =head1 DESCRIPTION List information about I (the $HOME directory by default). Sort entries alphabetically. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I (optional) The name of the ECaccess File/Directory to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-long> Print detailed information about each file. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List information about each ECaccess File in the $HOME directory of the authenticated user. B I List information about each ECaccess File in the $HOME/bin directory of the user xyz. B I<'home:/xyz/*.txt'> List information about each ECaccess File ending with ".txt" in the $HOME/bin directory of the user xyz. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-get0100755 0000000 0000000 00000012477 14323263312 022436 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-get: Download an ECaccess File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; my %opt = ( progress => 0, offset => 0, bufsize => 1048576, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( progress offset=i bufsize=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $sourceECaccessFile = $ARGV[0]; my $targetLocalFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-ecaccess-file specified!\n" ) if not($sourceECaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Get the details of the remote file my @files = $controlChannel->getDirList( $token, $sourceECaccessFile, 'false' )->valueof('//getDirListResponse/return'); my $size; # Reject if it is not a regular file die "Source-ecaccess-file is not a regular file!\n" if not( @files eq '1' ) or ( $size = $files[0]->{size} ) eq '-1'; # If no target-file is specified then take the source-file name $targetLocalFile = $files[0]->{name} if not($targetLocalFile); # Get the file handle $handle = $controlChannel->getInputFileHandle( $token, $sourceECaccessFile, $opt{offset} )->result; # Open the target file open FILE, ">", $targetLocalFile or die "Error creating file: " . $targetLocalFile . "\n"; binmode FILE; # Open the source file my $socket = $ecaccess->getFileInputStream($handle); # Progress bar my $progressbar; my $readCount = 0; my $readTotal = 0; if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ) { eval "use Term::ProgressBar"; $progressbar = Term::ProgressBar->new( { count => $size, remove => 1 } ); $progressbar->update(0); } # Read the file while (1) { $readCount = $socket->read_entity_body( $data, $opt{bufsize} ); die "Error downloading file: " . $targetLocalFile . "\n" unless defined $readCount; last unless $readCount; $readTotal += $readCount; print FILE $data; $progressbar->update($readTotal) if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ); } # Close the file handles $controlChannel->closeHandle($handle); close FILE; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-get - Download an ECaccess File =head1 SYNOPSIS B B IB<] [-bufsize> IB<]> I B<[>IB<]> =head1 DESCRIPTION Allow downloading the I. If no I is specified then the I name is used. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The name of the Source ECaccess File. =item I (optional) The name of the Target Local File. =back =head1 OPTIONS =over 8 =item B<-progress> Provide a progress meter on the standard terminal, allowing to monitor the file transmission in real-time. The progress bar is removed from the terminal when the transmission is done. This option is not supported and ignored on Windows platforms. =item B<-offset> I Every open file has an associated file offset, which determines where the next read operation will start. This I is set to 0 by default. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to download the file. The larger the buffer the smaller the number of http/s requests. By default a buffer of 1048576 bytes (1MB) is used. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Download the I File in the $HOME/bin directory of the authenticated user. The Target File Name is I. A progress bar is displayed during the transmission. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-mdelete0100755 0000000 0000000 00000007512 14323263312 023270 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-mdelete: Delete Multiple ECaccess Files at once # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; use Term::Prompt; use Number::Bytes::Human qw(format_bytes); my %opt = ( force => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( force version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-ecaccess-files specified!\n" ) if not(@ARGV); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Process all source Files from the command-line foreach (@ARGV) { my $sourceFiles = $_; # Get the list of Files to download my $files = $controlChannel->getDirList( $token, $sourceFiles ); # Delete each File foreach my $file ( $files->valueof('//getDirListResponse/return') ) { # Set source filename my $source = $file->{domain} . "/" . $file->{name}; # Do we delete this file? (don't process directories and symbolic links) if ( not( substr( $file->{permissions}, 0, 1 ) eq 'd' ) && not( substr( $file->{permissions}, 0, 1 ) eq 'l' ) && $file->{size} >= '0' && ( $opt{force} || &prompt( "y", "Delete " . $source, "y/n", "y" ) ) ) { print "Deleting " . $source . " (" . ( format_bytes( $file->{size} ) ) . ") ...\n"; # Delete the source file $controlChannel->deleteFile( $token, $source, SOAP::Data->type( boolean => 'true' ) ); } } } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-mdelete - Delete Multiple ECaccess Files at once =head1 SYNOPSIS B B I B<[>I<...>B<]> =head1 DESCRIPTION Allow deleting Multiple ECaccess Files at once. Each I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I B<[>I<...>B<]> The name(s) of the ECaccess File(s) to delete. =back =head1 OPTIONS =over 8 =item B<-force> Overrides the interactive mode and delete each file without prompting. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<'home:/xyz/bin/*.bin'> Delete the I<*.bin> Files in the $HOME/bin directory of the user xyz without prompting. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-mget0100755 0000000 0000000 00000014133 14323263312 022602 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-mget: Download Multiple ECaccess Files at once # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; use Term::Prompt; use Number::Bytes::Human qw(format_bytes); my %opt = ( progress => 0, force => 0, bufsize => 1048576, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( progress force bufsize=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $targetLocalDirectory = pop(@ARGV); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-ecaccess-file(s) specified!\n" ) if not(@ARGV) and not($targetLocalDirectory); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-local-directory specified!\n" ) if not(@ARGV); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Target-local-directory is not a directory!\n" ) if not( -d $targetLocalDirectory ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Process all source Files from the command-line foreach (@ARGV) { my $sourceFiles = $_; # Get the list of Files to download my $files = $controlChannel->getDirList( $token, $sourceFiles ); # Download each File foreach my $file ( $files->valueof('//getDirListResponse/return') ) { # Set source and target filenames my $source = $file->{domain} . "/" . $file->{name}; my $target = $targetLocalDirectory . "/" . $file->{name}; # Do we upload this file? (don't process directories and symbolic links) if ( not( substr( $file->{permissions}, 0, 1 ) eq 'd' ) && not( substr( $file->{permissions}, 0, 1 ) eq 'l' ) && $file->{size} >= '0' && ( $opt{force} || &prompt( "y", "Download " . $source, "y/n", "y" ) ) ) { print "Downloading " . $source . " -> " . $target . " (" . ( format_bytes( $file->{size} ) ) . ") ...\n"; # Get the file handle and open the target file $handle = $controlChannel->getInputFileHandle( $token, $source, 0 )->result; open FILE, ">", $target or die "Error creating file: " . $target . "\n"; # Progress bar my $progressbar; my $readCount = 0; my $readTotal = 0; if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ) { eval "use Term::ProgressBar"; $progressbar = Term::ProgressBar->new( { count => $file->{size}, remove => 1 } ); $progressbar->update(0); } # Open the source file my $socket = $ecaccess->getFileInputStream($handle); # Read the file while (1) { $readCount = $socket->read_entity_body( $data, $opt{bufsize} ); die "Error downloading file: " . $target . "\n" unless defined $readCount; last unless $readCount; $readTotal += $readCount; print FILE $data; $progressbar->update($readTotal) if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ); } # Close the file handles $controlChannel->closeHandle($handle); close FILE; } } } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-mget - Download Multiple ECaccess Files at once =head1 SYNOPSIS B B IB<]> I B<[>I<...>B<]> I =head1 DESCRIPTION Allow downloading Multiple ECaccess Files at once in the specified I. Each I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. Please note this command is not recursive and will only download the plain-files in the I directory (sub-directories are ignored). =head1 ARGUMENTS =over 8 =item I B<[>I<...>B<]> The name(s) of the source ECaccess File(s). =item I The name of the target Local Directory. =back =head1 OPTIONS =over 8 =item B<-progress> Provide a progress meter on the standard terminal, allowing to monitor the file transmission in real-time. The progress bar is removed from the terminal when the transmission is done. This option is not supported and ignored on Windows platforms. =item B<-force> Overrides the interactive mode and download each file without prompting. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to download the files. The larger the buffer the smaller the number of http/s requests. By default a buffer of 1048576 bytes (1MB) is used. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<'home:/xyz/bin/*.bin'> I<$HOME/bin> Download the I<*.bin> Files in the $HOME/bin directory of the user xyz. The Files are downloaded in the local $HOME/bin directory. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-mkdir0100755 0000000 0000000 00000005602 14323263312 022755 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-mkdir: Make a Directory on the ECaccess File System # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ecaccessFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Create the directory $controlChannel->makeDirectory( $token, $ecaccessFile ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-mkdir - Make a Directory on the ECaccess File System =head1 SYNOPSIS B B I =head1 DESCRIPTION Make the Directory I on the ECaccess File System, if it does not already exist. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The name of the ECaccess Directory to create. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Make the I Directory in the "/c1a/tmp/systems/xyz" directory on c1a. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-modtime0100755 0000000 0000000 00000005650 14323263312 023310 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-modtime: Show the Last Modification Time of an ECaccess File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ecaccessFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Get the modtime print $controlChannel->getFileLastModified( $token, $ecaccessFile )->result . "\n"; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-modtime - Show the Last Modification Time of an ECaccess File =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow showing the Last Modification Time of I. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The name of the ECaccess File to show the Last Modification Time. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Display the Last Modification Time of the I File in the $HOME/bin directory of the authenticated user. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-move0100755 0000000 0000000 00000007167 14323263312 022625 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-move: Move or Rename ECaccess Files # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $sourceECaccessFile = $ARGV[0]; my $targetECaccessFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-ecaccess-file specified!\n" ) if not($sourceECaccessFile); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-ecaccess-file specified!\n" ) if not($targetECaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the file $controlChannel->moveFile( $token, $sourceECaccessFile, $targetECaccessFile ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-move - Move or Rename ECaccess Files =head1 SYNOPSIS B B I I =head1 DESCRIPTION Allow moving an ECaccess File. When the move occurs within the same ECaccess File System then it is a rename. When the move occurs across two different ECaccess File Systems then first a copy is done and then a delete of the original file is done (e.g. similar to ecaccess-file-copy ... -erase). The I and I are in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The source ECaccess File name. =item I The target ECaccess File name. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I I Rename the I file in the ECFS directory of the authenticated user in I. B I I Copy the I file from the ECFS directory of the authenticated user to the I file in the $HOME directory of the authenticated user, then delete the I file from ECFS. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-mput0100755 0000000 0000000 00000014104 14323263312 022631 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-mput: Upload Multiple Local Files on the ECaccess File System at once # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; use Term::Prompt; use Number::Bytes::Human qw(format_bytes); use File::Basename; my %opt = ( progress => 0, force => 0, umask => 640, bufsize => 10485760, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( progress force umask=i bufsize=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $targetECaccessDirectory = pop(@ARGV); @ARGV = map glob, @ARGV if $^O =~ /^MSWin/; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-local-file(s) specified!\n" ) if not(@ARGV) and not($targetECaccessDirectory); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target-ecaccess-directory specified!\n" ) if not(@ARGV); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Check if the target directory exists and is a directory pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Target is not a directory!\n" ) if not( $controlChannel->getFileSize( $token, $targetECaccessDirectory )->result == '-1' ); # If we have a domain with no user specified then include the '.' $targetECaccessDirectory .= ( $targetECaccessDirectory =~ /\w:$/ ? "." : "" ); # Format the target directory $targetECaccessDirectory .= ( $targetECaccessDirectory =~ m/\/$/ ? "" : "/" ); # Process all source Files from the command-line foreach (@ARGV) { # Set source and target filenames my $source = $_; my $target = $targetECaccessDirectory . ( basename($source) ); my $size; # Do we upload this file? (don't process not-plain-files) if ( -f $source && ( $opt{force} || &prompt( "y", "Upload " . $source, "y/n", "y" ) ) ) { print "Uploading " . $source . " -> " . $target . " (" . ( format_bytes( $size = -s $source ) ) . ") ...\n"; # Progress bar my $progressbar; my $readCount = 0; my $readTotal = 0; if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ) { eval "use Term::ProgressBar"; $progressbar = Term::ProgressBar->new( { count => $size, remove => 1 } ); $progressbar->update(0); } # Get the file handle $handle = $controlChannel->getOutputFileHandle( $token, $target, 0, $opt{umask} )->result; # Open the Source File open FILE, $source or die "Error opening file: " . $source . "\n"; binmode FILE; # Upload the content while ( ( $readCount = read( FILE, $data, $opt{bufsize} ) ) > 0 ) { $ecaccess->writeFileOutputStream( $handle, $data ); $progressbar->update( $readTotal += $readCount ) if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ); } # close the file handles $controlChannel->closeHandle($handle); close FILE; } } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-mput - Upload Multiple Local Files on the ECaccess File System at once =head1 SYNOPSIS B B IB<] [-bufsize> IB<]> I B<[>I<...>B<]> I =head1 DESCRIPTION Allow uploading Multiple Local Files on I at once. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. Please note this command is not recursive and will only upload plain-files (directories specified as I are ignored). =head1 ARGUMENTS =over 8 =item I B<[>I<...>B<]> The name(s) of the source File(s). =item I The name of the target ECaccess Directory. =back =head1 OPTIONS =over 8 =item B<-progress> Provide a progress meter on the standard terminal, allowing to monitor the file transmission in real-time. The progress bar is removed from the terminal when the transmission is done. This option is not supported and ignored on Windows platforms. =item B<-force> Overrides the interactive mode and upload each file without prompting. =item B<-umask> I The user file-creation I mask (umask) is used to determine the file permission for newly created files. The default value is 640. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to upload the files. The larger the buffer the smaller the number of http/s requests. By default a buffer of 10485760 bytes (10MB) is used. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<$HOME/*.txt> I Upload the local I<$HOME/*.txt> Files in the ECaccess $HOME directory of the user xyz. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-put0100755 0000000 0000000 00000012510 14323263312 022453 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-put: Upload a File on the ECaccess File System # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; use File::Basename; my %opt = ( progress => 0, umask => 640, offset => 0, bufsize => 10485760, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( progress umask=i offset=i bufsize=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $sourceLocalFile = $ARGV[0]; my $targetECaccessFile = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source-local-file specified!\n" ) if not($sourceLocalFile); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Source-local-file is not a plain file!\n" ) if not( -f $sourceLocalFile ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # If no target is specified then take the source filename $targetECaccessFile = basename($sourceLocalFile) if not($targetECaccessFile); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Get the file handle $handle = $controlChannel->getOutputFileHandle( $token, $targetECaccessFile, $opt{offset}, $opt{umask} )->result; # Open the Source File open FILE, $sourceLocalFile or die "Error opening file: " . $sourceLocalFile . "\n"; # Progress bar my $progressbar; my $readCount = 0; my $readTotal = 0; if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ) { eval "use Term::ProgressBar"; $progressbar = Term::ProgressBar->new( { count => -s $sourceLocalFile, remove => 1 } ); $progressbar->update(0); } # Upload the content while ( ( $readCount = read( FILE, $data, $opt{bufsize} ) ) > 0 ) { $ecaccess->writeFileOutputStream( $handle, $data ); $progressbar->update( $readTotal += $readCount ) if ( $opt{progress} && not( $^O =~ /^MSWin/ ) ); } # close the file handles $controlChannel->closeHandle($handle); close FILE; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-put - Upload a File on the ECaccess File System =head1 SYNOPSIS B B IB<] [-offset> IB<] [-bufsize> IB<]> I B<[>IB<]> =head1 DESCRIPTION Allow uploading I on the ECaccess File System. If no I is specified then the I name is used. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I The name of the source Local File. =item I (optional) The name of the target ECaccess File. =back =head1 OPTIONS =over 8 =item B<-progress> Provide a progress meter on the standard terminal, allowing to monitor the file transmission in real-time. The progress bar is removed from the terminal when the transmission is done. This option is not supported and ignored on Windows platforms. =item B<-umask> I The user file-creation I mask (umask) is used to determine the file permission for newly created files. The default value is 640. =item B<-offset> I Every open file has an associated file offset, which determines where the next read operation will start. This I is set to 0 by default. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to upload the file. The larger the buffer the smaller the number of http/s requests. By default a buffer of 10485760 bytes (10MB) is used. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<$HOME/bin/a.out> Upload the local I<$HOME/bin/a.out> File in the $HOME directory of the authenticated user. The Target File Name is I. B I<$HOME/bin/a.out> I Upload the local I<$HOME/bin/a.out> File in the tmp directory of c1a. The Target File Name is I. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-rmdir0100755 0000000 0000000 00000005562 14323263312 022771 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-rmdir: Remove a Directory on the ECaccess File System # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ecaccessFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No ecaccess-file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the file $controlChannel->removeDirectory( $token, $ecaccessFile ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-rmdir - Remove a Directory on the ECaccess File System =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow removing the Directory I on the ECaccess File System. The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I Then name of the ECaccess Directory to remove. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Remove the I Directory in the "/c1a/tmp/systems/xyz" directory on c1a. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-file-size0100755 0000000 0000000 00000006075 14323263312 022626 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-file-size: Show the Size of an ECaccess File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Number::Bytes::Human qw(format_bytes); my %opt = ( human => 0, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( human version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $ecaccessFile = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No file specified!\n" ) if not($ecaccessFile); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Get the modtime my $size = $controlChannel->getFileSize( $token, $ecaccessFile )->result; # Display the result if ( $opt{human} ) { print format_bytes($size) . "\n"; } else { print $size. "\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-file-size - Show the Size of an ECaccess File =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow showing the size of I (-1 for a directory). The I is in the form [domain:][/user-id/]path. Please read the "Shell commands -> File Management" section of the "ecaccess" guide for more information on the ECaccess File System. =head1 ARGUMENTS =over 8 =item I Then name of the ECaccess File to get the size. =back =head1 OPTIONS =over 8 =item B<-human> Print size in human readable format (e.g. 234M). =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I Display the Size of the I File in the $HOME/bin directory of the authenticated user. =head1 SEE ALSO B, B, B, B, B, B, B, B, B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-gateway-connected0100755 0000000 0000000 00000004040 14323263312 024326 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-gateway-connected: Display the ECaccess Gateway Connection Status # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Display the Status of the Connection to ECMWF print $controlChannel->gatewayIsConnected()->result ? "yes" : "no", "\n"; __END__ =head1 NAME ecaccess-gateway-connected - Display the ECaccess Gateway Connection Status =head1 SYNOPSIS B B =head1 DESCRIPTION Display the connection status of the ECaccess Gateway you are connected to. =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B Display the connection status of the current ECaccess Gateway. =head1 SEE ALSO B, B, B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-gateway-list0100755 0000000 0000000 00000006203 14323263312 023342 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-gateway-list: List the ECaccess Gateways # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, retry => 0, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $gatewayName = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($gatewayName) ) { # Get the list of Gateways my $gateways = $controlChannel->getGatewayList($token); # Display the information for each Gateway foreach $gateway ( $gateways->valueof('//getGatewayListResponse/return') ) { printf "%-16s %-12s %s", $gateway->{version}, $gateway->{lastReport}, $gateway->{name}; print " (off)" if not( $gateway->{active} eq 'true' ); print "\n"; } } else { # Get the detail for the specified Gateway my $gateway = $controlChannel->getGateway( $token, $gatewayName )->valueof('//getGatewayResponse/return'); print " Name: " . $gateway->{name} . "\n"; print " Version: " . $gateway->{version} . "\n"; print " OS/JDK: " . $gateway->{comment} . "\n"; print "Connected: " . ( $gateway->{active} eq 'true' ? 'yes' : 'no' ) . " (since " . $gateway->{lastReport} . ")\n"; } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-gateway-list - List the ECaccess Gateways =head1 SYNOPSIS B B B<[>IB<]> =head1 DESCRIPTION List all the ECaccess Gateways. When a I is specified then the details for this Gateway are displayed. =head1 ARGUMENTS =over 8 =item I (optional) The name of the ECaccess Gateway to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List all the ECaccess Gateways. B I List the details for the ECaccess Gateway I. =head1 SEE ALSO B, B, B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-gateway-name0100755 0000000 0000000 00000004467 14323263312 023321 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-gateway-name: Display the name of the default ECaccess Gateway # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Display the Gateway Name print $controlChannel->getGatewayName()->result . "\n"; __END__ =head1 NAME ecaccess-gateway-name - Display the name of the default ECaccess Gateway =head1 SYNOPSIS B B =head1 DESCRIPTION Display the Name of the Gateway you are connected to. If you want to use another Gateway (e.g. a local Gateway) instead of the default boaccess.ecmwf.int Gateway then you can use the following environment parameters: http_ecaccess=gateway.meteo.ms:9080 https_ecaccess=gateway.meteo.ms:9443 (e.g. if your local ECaccess Gateway name is "gateway.meteo.ms" and you are using the default ECaccess http/s ports 9080/9443) =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B Display the name of the current ECaccess Gateway. =head1 SEE ALSO B, B, B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-job-delete0100755 0000000 0000000 00000004453 14323263312 022747 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-job-delete: Delete an ECaccess Job # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $jobId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No job-id specified!\n" ) if not($jobId); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the Job $controlChannel->deleteJob( $token, $jobId ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-job-delete - Delete an ECaccess Job =head1 SYNOPSIS B B I =head1 DESCRIPTION Allow deleting the ECaccess Job with the identifier I. =head1 ARGUMENTS =over 8 =item I The identifier of the ECaccess Job to delete. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Delete the Job with the identifier I<124356>. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-job-get0100755 0000000 0000000 00000010271 14323263312 022257 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-job-get: Download a Job Output/Input/Error File # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use MIME::Base64; my %opt = ( input => 0, error => 0, bufsize => 524288, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( input error bufsize=i version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $jobId = $ARGV[0]; my $target = $ARGV[1]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No job-id specified!\n" ) if not($jobId); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No target specified!\n" ) if not($target); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Incompatible options!(-input,-error)\n" ) if ( $opt{input} && $opt{error} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Get the file handle (output, input or error) $handle = $controlChannel->getJobOutputHandle( $token, $jobId )->result if not ( $opt{input} || $opt{error} ); $handle = $controlChannel->getJobInputHandle( $token, $jobId )->result if ( $opt{input} ); $handle = $controlChannel->getJobErrorHandle( $token, $jobId )->result if ( $opt{error} ); # Open the Target File open FILE, ">", $target or die "Error creating file: " . $target . "\n"; binmode FILE; # Open the source file my $socket = $ecaccess->getFileInputStream($handle); # Read the file while (1) { my $readCount = $socket->read_entity_body( $data, $opt{bufsize} ); die "Error downloading file\n" unless defined $readCount; last unless $readCount; print FILE $data; } # close the file handles $controlChannel->closeHandle($handle); close FILE; # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-job-get - Download a Job Output/Input/Error File =head1 SYNOPSIS B B IB<]> I I =head1 DESCRIPTION Allow downloading the Job Output/Input/Error Files with identifier I. The file is downloaded localy in the I. =head1 ARGUMENTS =over 8 =item I The identifier of the ECaccess Job to retrieve. =item I The name of the Local Target File. =back =head1 OPTIONS =over 8 =item B<-input> By default the Job Output File is downloaded. Using this option allow downloading the Job Input File instead. =item B<-error> By default the Job Output File is downloaded. Using this option allow downloading the Job Error File instead. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to download the file. The larger the buffer the smaller the number of http/s requests. By default a buffer of 524288 bytes (512KB) is used. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> I<./ecaccess-job-124356.output> Download the output of the ECaccess Job I<124356> in the local I file. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-job-list0100755 0000000 0000000 00000011605 14323263312 022455 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-job-list: List all ECaccess Jobs # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $jobId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($jobId) ) { # Get the list of jobs my $jobs = $controlChannel->getJobList($token); # Display the information for each job foreach $job ( $jobs->valueof('//getJobListResponse/return') ) { printf "%-10s %-10s %-10s %-6s %-15s", $job->{jobId}, $job->{queueName}, $job->{status}, $job->{tryDone} . "/" . $job->{tryCount}, $job->{scheduledDate}; my $space = 0; if ( $job->{eventIds} ) { if ( @{$job->{eventIds}} > 0 ) { # This is a list of events print "["; foreach my $eventId(@{$job->{eventIds}}) { print ";" if ($space != 0); print $eventId; $space = 1; } print "]"; } else { # Only one event to display print "[".$job->{eventIds}."]"; } } else { print "[-]"; } print " " . $job->{name} if ( $job->{name} ); print "\n"; } } else { # Get the detail for the specified jobId my $job = $controlChannel->getJob( $token, $jobId )->valueof('//getJobResponse/return'); print " Job-Id: " . $job->{jobId} . "\n"; print " Job Name: " . $job->{name} . "\n" if ( $job->{name} ); print " Queue: " . $job->{queueName} . "\n"; print " Host: " . $job->{hostName} . "\n" if ( $job->{hostName} ); print " Schedule: " . $job->{scheduledDate} . "\n"; print " Expiration: " . $job->{expirationDate} . "\n"; print " Try Count: " . $job->{tryDone} . "/" . $job->{tryCount} . "\n"; print " Status: " . $job->{status} . "\n"; my $space = 0; if ( $job->{eventIds} && @{$job->{eventIds}} > 0 ) { print " Event-Ids:"; foreach my $eventId(@{$job->{eventIds}}) { print ";" if ($space != 0); print $eventId; $space = 1; } print "\n"; } else { if ( $job->{eventIds} && @{$job->{eventIds}} == 0 ) { print " Event-Ids: ".$job->{eventIds}."\n"; } } if ( $job->{status} eq 'DONE' ) { print "Stdout Size: " . $job->{outputFileSize} . "\n" if ( $job->{outputFileSize} != '-1' ); print "Stderr Size: " . $job->{errorFileSize} . "\n" if ( $job->{errorFileSize} != '-1' ); print " Stdin Size: " . $job->{inputFileSize} . "\n" if ( $job->{inputFileSize} != '-1' ); } print " Comment: " . $job->{comment} . "\n" if ( $job->{comment} ); } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-job-list - List all ECaccess Jobs =head1 SYNOPSIS B B B<[>IB<]> =head1 DESCRIPTION List all your ECaccess Jobs. When a I is specified then the details for this job are displayed. The Job statuses can have the following values: =over 8 =item B Jobs are being initialised =item B Jobs are waiting for an event =item B Jobs are running =item B Jobs have been queued to the scheduler (e.g. LoadLeveler) =item B Jobs will be resubmitted =item B Jobs have NOT completed (error) =item B Jobs have successfully completed =back =head1 ARGUMENTS =over 8 =item I (optional) The identifier of the ECaccess Job to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Give the informations concerning the ECaccess Job with identifier I<124356>. B List all your ECaccess Jobs in the spool. =head1 SEE ALSO B, B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-job-restart0100755 0000000 0000000 00000004526 14323263312 023172 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-job-restart: Restart an ECaccess Job # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $jobId = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No job-id specified!\n" ) if not($jobId); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # Delete the Job $controlChannel->restartJob( $token, $jobId ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-job-restart - Restart an ECaccess Job =head1 SYNOPSIS B B I =head1 DESCRIPTION If the job with identifier I fails, this command instruct ECaccess to rerun it. =head1 ARGUMENTS =over 8 =item I The identifier of the ECaccess Job to restart. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<124356> Restart the ECaccess Job with the identifier I<124356>. =head1 SEE ALSO B, B, B, B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-job-submit0100755 0000000 0000000 00000030150 14323263312 023001 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-job-submit: Submit a new ECaccess Job # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use File::Basename; my %opt = ( distant => 0, bufsize => 524288, scheduledDate => undef, noDirectives => 0, gateway => undef, remote => undef, transferOutput => 0, transferError => 0, transferInput => 0, keep => 0, eventIds => undef, sterr2Stdout => 0, noRenew => 0, mailTo => undef, onStart => 0, onSuccess => 0, onFailure => 0, onRetry => 0, queueName => undef, jobName => undef, manPage => undef, lifeTime => 7, retryCount => 0, retryFrequency => 600, version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( distant bufsize=i scheduledDate|at=s noDirectives|nd gateway|tg=s remote|tr=s transferOutput|to transferError|te transferInput|ti keep|tk eventIds|ni=s sterr2Stdout|eo noRenew|ro mailTo|mu=s onStart|mb onSuccess|me onFailure|mf onRetry|mr queueName=s jobName|jn=s manPage|mp=s lifeTime|lt=i retryCount|rc=i retryFrequency|rf=i version help|? manual|man retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $source = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "No source specified!\n" ) if not($source); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Source is not a plain text file!\n" ) if not( $opt{distant} ) && not( -f $source && -T $source ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryCount specified (>0)!\n" ) if not( $opt{retryCount} >= 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -retryFrequency specified (>0)!\n" ) if not( $opt{retryFrequency} > 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 0, -msg => "Invalid -lifeTime specified (>0)!\n" ) if not( $opt{lifeTime} > 0 ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); # If the jobName options is not set then let's use the name of the input file my $jobName; if ( not( $opt{jobName} ) ) { $jobName = basename($source); } else { $jobName = $opt{jobName}; } # If the file is local then transfer it first if ( not( $opt{distant} ) ) { # Upload the file open FILE, $source or die "Error opening file: " . $source . "\n"; $source = $controlChannel->getTemporaryFile($token)->result; my $handle = $controlChannel->getOutputFileHandle( $token, $source, 0, 640 )->result; while ( read( FILE, $data, $opt{bufsize} ) > 0 ) { $ecaccess->writeFileOutputStream( $handle, $data ); } # Close handles $controlChannel->closeHandle($handle); close FILE; } else { # Copy the ECaccess file to a temporary file my $sourceECaccessFile = $source; $source = $controlChannel->getTemporaryFile($token)->result; $controlChannel->copyFile( $token, $sourceECaccessFile, $source, SOAP::Data->type( boolean => '0' ) ); } # Submit the Job $jobId = $controlChannel->submitJob( $token, SOAP::Data->name( "request" => \SOAP::Data->value( SOAP::Data->name( 'scheduledDate' => $opt{scheduledDate} ), SOAP::Data->name( 'userMailAddress' => $opt{mailTo} ), SOAP::Data->name( 'sendMailOnStart' => $opt{onStart} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'sendMailOnSuccess' => $opt{onSuccess} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'sendMailOnFailure' => $opt{onFailure} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'sendMailOnRetry' => $opt{onRetry} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'containsDirectives' => $opt{noDirectives} ? 'false' : 'true' )->type('xsd:boolean'), SOAP::Data->name( 'queueName' => $opt{queueName} ), SOAP::Data->name( 'name' => $jobName ), SOAP::Data->name( 'transferGatewayName' => $opt{gateway} ), SOAP::Data->name( 'transferRemoteLocation' => $opt{remote} ), SOAP::Data->name( 'transferOutputFile' => $opt{transferOutput} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'transferErrorFile' => $opt{transferError} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'transferInputFile' => $opt{transferInput} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'transferKeepInSpool' => $opt{keep} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'renewSubscription' => $opt{noRenew} ? 'false' : 'true' )->type('xsd:boolean'), SOAP::Data->name( 'errorToOutput' => $opt{sterr2Stdout} ? 'true' : 'false' )->type('xsd:boolean'), SOAP::Data->name( 'manPageContent' => $opt{manPage} ), SOAP::Data->name( 'lifeTime' => $opt{lifeTime} ), SOAP::Data->name( 'retryCount' => $opt{retryCount} ), SOAP::Data->name( 'retryFrequency' => $opt{retryFrequency} ), SOAP::Data->name( 'eventIds' => $opt{eventIds} ), SOAP::Data->name( 'inputFile' => $source ) ) ) )->result; print $jobId. "\n"; # Delete the temporary file $controlChannel->deleteFile( $token, $source, SOAP::Data->type( boolean => '1' ) ); # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-job-submit - Submit a new ECaccess Job =head1 SYNOPSIS B B IB<] [-scheduledDate> IB<] [-noDirectives] [-gateway> IB<] [-remote> IB<] [-transferOutput] [-transferError] [-transferInput] [-keep] [-eventIds> IB<] [-sterr2Stdout] [-noRenew] [-mailTo> IB<] [-onStart] [-onSuccess] [-onFailure] [-onRetry] [-jobName> IB<] [-manPage> IB<] [-lifeTime> IB<] [-retryCount> IB<] [-retryFrequency> IB<] [-queueName> IB<]> I =head1 DESCRIPTION Allow submitting the I script on either the default ECaccess batch queue or the ECaccess batch queue specified with the I<-queueName> option. ECaccess batch queue name can be obtained with the B command (the default queue is the first in the list). A special service (see option B<-eventIds>) allows to automatically submit jobs to be run when certain points in the daily ECMWF operational forecast suite have been reached. The main purpose is to ensure that certain data is available before e.g. submitting a MARS request. These events correspond to the different stages when the ECMWF operational activity has produced certain data or products. The list of events can be retrieved with the B command. In order to facilitate the migration from the old ECtools (ecjreq/ecjput commands) the equivalents options can be set using their old names (e.g. B<-at> for B<-scheduledDate>). This should limit the scripts modifications for job submissions. =head1 ARGUMENTS =over 8 =item I The name of the file which contains the job input script (depending of the -distant option this file is either at ECMWF or local to your workstation). =back =head1 OPTIONS =over 8 =item B<-distant> By default the I is specifying a file which is local to your workstation. Using this option allow submitting a script which is already at ECMWF. =item B<-bufsize> I Specify the I of the buffer (in bytes) which is used to upload the file. The larger the buffer the smaller the number of http/s requests. By default a buffer of 524288 bytes (512KB) is used. This option only apply for local scripts (no B<-distant>). =item B<-at, -scheduledDate> I Allow specifying the start I for the Job. By default the job will start as soon as possible. The format for the date is 'yyyy-MM-dd HH:mm'. =item B<-nd, -noDirectives> Allow submitting a job with no scheduler directives. Some default directives will be added to your input script to allow processing the job. =item B<-tg, -gateway> I This is the I of the target ECaccess Gateway for the transfers. It is by default the Gateway you are connected to. In order to get the name of your current Gateway you can use the B command. When using the commands at ECMWF the default Gateway is always "boaccess.ecmwf.int". =item B<-tr, -remote> I Defines the target ECtrans I in the format IB<[>I<@protocol>B<]>. =item B<-to, -transferOutput> Request the transfer of the job standard output to the gateway and remote location defined in the B<-gateway> and B<-remote> options. =item B<-te, -transferError> Request the transfer of the job error output to the gateway and remote location defined in the B<-gateway> and B<-remote> options. =item B<-ti, -transferInput> Request the transfer of the job input to the gateway and remote location defined in the B<-gateway> and B<-remote> options. =item B<-tk, -keep> Allow keeping the transfers requests in the spool. =item B<-ni, -eventIds> I Allow giving a I of event-identifiers to subscribe to with the Job. The list should be separated by ';' or ','. Only one job will be launched when all the events in the list have been reached. To submit the same job to multiple events, one will need to submit the job to each event separately. =item B<-eo, -sterr2Stdout> Force redirection of the job standard error output (stderr) to the job standard output (stdout). =item B<-ro, -noRenew> The job subscriptions to events will not be renewed. =item B<-mu, -mailTo> I Defines the target I address (default: current ECMWF user identifier). =item B<-mb, -onStart> Allow sending a mail when the execution/transfer begins. =item B<-me, -onSuccess> Allow sending a mail when the execution/transfer ends. =item B<-mf, -onFailure> Allow sending a mail when the execution/transfer fails. =item B<-mr, -onRetry> Allow sending a mail when the execution/transfer retries. =item B<-queueName> I The name of the ECaccess batch queue to submit the job to. =item B<-jn, -jobName> I Allow specifying a I for the new Job (other than the Job Identifier). If no name is specified then the name of the input script is used. =item B<-mp, -manPage> I Allow giving the man page I which will be displayed to the ECMWF operators in case of problems with your Job (e.g. what to do or who to contact). =item B<-lt, -lifeTime> I Allow specifying the job input/output life time in I. The default is 7 days. =item B<-rc, -retryCount> I Defines the I of retries. The default is 0. =item B<-rf, -retryFrequency> I Defines the I of retries in seconds. The default is 600 seconds. =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B I<./test.txt> Transfer the local file I to your ECMWF spool and submit the job to the default ECaccess batch queue. The source does not have any directives. =head1 SEE ALSO B, B, B, B, B B and B. =cut ecaccess-webtoolkit-perl-src-6.3.1/script/ecaccess-queue-list0100755 0000000 0000000 00000007357 14323263312 023040 0ustar000000000 0000000 #!/usr/bin/perl -w # # ecaccess-queue-list: List available queues # # Laurent.Gougeon@ecmwf.int - 2010-10-15 use ECMWF::ECaccess; use Getopt::Long; use Pod::Usage; use Term::ReadKey; my %opt = ( version => 0, help => 0, manual => 0, retry => 0, debug => 0 ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if !GetOptions( \%opt, qw( version help|? manual retry=i debug ) ); # Display version if requested die ECMWF::ECaccess->VERSION . "\n" if ( $opt{version} ); my $queueName = $ARGV[0]; pod2usage( -noperldoc => 1, -exit => 1, verbose => 1 ) if ( $opt{help} ); pod2usage( -noperldoc => 1, -exit => 1, verbose => 2 ) if ( $opt{manual} ); # Create the ECaccess Controler my $ecaccess = ECMWF::ECaccess->new( $opt{retry}, $opt{debug}); # Get the Token (using the Certificate in $HOME) my $token = $ecaccess->getToken(); # Get the Control Channel my $controlChannel = $ecaccess->getControlChannel(); if ( not($queueName) ) { # Get the list of queues my $queues = $controlChannel->getQueueList($token); # Display the information for each queue foreach $queue ( $queues->valueof('//getQueueListResponse/return') ) { printf "%-15s %-15s %s (INIT=%s,WAIT=%s,EXEC=%s,DONE=%s,STOP=%s)\n", $queue->{queueName}, $queue->{schedulerName}, $queue->{comment}, $queue->{numberOfJobsInInitState}, $queue->{numberOfJobsInWaitState}, $queue->{numberOfJobsInExecState}, $queue->{numberOfJobsInDoneState}, $queue->{numberOfJobsInStopState}; } } else { # Get the detail for the specified queue foreach $queue ( $controlChannel->getQueueDetail( $token, $queueName )->valueof('//getQueueDetailResponse/return') ) { printf "%-20s %s\n", $queue->{name}, $queue->{comment}; } } # Logout END { $ecaccess->releaseToken($token) if ($token); } __END__ =head1 NAME ecaccess-queue-list - List available queues =head1 SYNOPSIS B B B<[>IB<]> =head1 DESCRIPTION Two different types of queues are in use with ECaccess: B<1> - The ECaccess batch queues, which correspond to one system at ECMWF with its specific batch environment, e.g. ecgate will be the ECaccess queue, which will redirect jobs to ecgate at ECMWF, running LoadLeveler. This ECaccess queue will be given as argument when submitting a batch job. B<2> - The batch queues (or classes) on the systems at ECMWF will be given in the batch job with #@ class = for LoadLeveler. The names of the ECaccess queues and associated batch queues at ECMWF can be seen with this command. When an ECaccess I is specified then the details for this queue are displayed (including the list of classes). The first ECaccess batch queue in the list is the default queue when submitting a batch job with the B command. =head1 ARGUMENTS =over 8 =item I (optional) The name of the ECaccess queue to retrieve the details. =back =head1 OPTIONS =over 8 =item B<-version> Display version number and exits. =item B<-help> Print a brief help message and exits. =item B<-manual> Prints the manual page and exits. =item B<-retry> I Number of SSL connection retries per 5s to ECMWF. This parameter only apply to the initial SSL connection initiated by the command to the ECMWF server. It does not apply to all the subsequent requests made afteward as it is mainly targeting errors that can happen from time to time during the SSL handshake. Default is no retry. =item B<-debug> Display the SOAP and SSL messages exchanged. =back =head1 EXAMPLES B List all the ECaccess batch queues (or systems supporting job submission at ECMWF). B I List all the batch queues (or classes) on the ECMWF system I. =head1 SEE ALSO B. =cut ecaccess-webtoolkit-perl-src-6.3.1/t/ECMWF-ECaccess.t0100755 0000000 0000000 00000001404 14323263312 020670 0ustar000000000 0000000 use Test::More tests => 5; use ECMWF::ECaccess; no warnings qw(uninitialized); my $ecaccess = ECMWF::ECaccess->new(0, $ENV{'TEST_VERBOSE'} eq '1'); my $controlChannel = $ecaccess->getControlChannel(); my $dataChannel = $ecaccess->getDataChannel(); my $gatewayName = $controlChannel->getGatewayName()->result; my $gatewayConnected = $controlChannel->gatewayIsConnected()->result; ok( defined($ecaccess) && ref $ecaccess eq 'ECMWF::ECaccess', 'new() works' ); ok( defined($controlChannel), 'getControlChannel() works' ); ok( defined($dataChannel), 'getDataChannel() works' ); ok( defined($gatewayName), 'getGatewayName() works (' . $gatewayName . ')' ); ok( defined($gatewayConnected), 'gatewayIsConnected() works (' . $gatewayConnected . ')' ); ecaccess-webtoolkit-perl-src-6.3.1/0040755 0000000 0000000 00000000000 14323263312 015731 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/html/0040755 0000000 0000000 00000000000 14323263311 016674 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/lib/0040755 0000000 0000000 00000000000 14323263312 016477 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/lib/ECMWF/0040755 0000000 0000000 00000000000 14323263312 017340 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/man/0040755 0000000 0000000 00000000000 14323263311 016503 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/man/man1/0040755 0000000 0000000 00000000000 14323263311 017337 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/man/man3/0040755 0000000 0000000 00000000000 14323263311 017341 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/script/0040755 0000000 0000000 00000000000 14323263312 017235 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/t/0040755 0000000 0000000 00000000000 14323263312 016174 5ustar000000000 0000000 ecaccess-webtoolkit-perl-src-6.3.1/Changes0100644 0000000 0000000 00000000247 14323263312 017224 0ustar000000000 0000000 Revision history for Perl extension ECMWF::ECaccess. 6.3.1 Mon Oct 17 14:25:12 2022 - data center in bologna; 4.0.0 Wed Sep 21 10:23:44 2011 - original version; ecaccess-webtoolkit-perl-src-6.3.1/MANIFEST0100644 0000000 0000000 00000002503 14323263312 017057 0ustar000000000 0000000 script/ecaccess script/ecaccess-association-delete script/ecaccess-association-get script/ecaccess-association-list script/ecaccess-association-protocol script/ecaccess-association-put script/ecaccess-certificate-create script/ecaccess-certificate-list script/ecaccess-cosinfo script/ecaccess-ectrans-delete script/ecaccess-ectrans-list script/ecaccess-ectrans-request script/ecaccess-ectrans-restart script/ecaccess-event-clear script/ecaccess-event-create script/ecaccess-event-delete script/ecaccess-event-grant script/ecaccess-event-list script/ecaccess-event-send script/ecaccess-file-chmod script/ecaccess-file-copy script/ecaccess-file-delete script/ecaccess-file-dir script/ecaccess-file-get script/ecaccess-file-mdelete script/ecaccess-file-mget script/ecaccess-file-mkdir script/ecaccess-file-modtime script/ecaccess-file-move script/ecaccess-file-mput script/ecaccess-file-put script/ecaccess-file-rmdir script/ecaccess-file-size script/ecaccess-gateway-connected script/ecaccess-gateway-list script/ecaccess-gateway-name script/ecaccess-job-delete script/ecaccess-job-get script/ecaccess-job-list script/ecaccess-job-restart script/ecaccess-job-submit script/ecaccess-queue-list Changes lib/ECMWF/ECaccess.pm Makefile.PL MANIFEST README t/ECMWF-ECaccess.t META.yml Module meta-data (added by MakeMaker) ecaccess-webtoolkit-perl-src-6.3.1/META.yml0100644 0000000 0000000 00000001604 14323263312 017200 0ustar000000000 0000000 --- #YAML:1.0 name: ECMWF-ECaccess version: 0.01 abstract: Perl extension to access the ECMWF ECaccess Web Services (or ECaccess API) author: - Laurent Gougeon license: unknown distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Class::Inspector: 0 Crypt::SSLeay: 0 Getopt::Long: 0 MIME::Base64: 0 Net::HTTP: 0 Number::Bytes::Human: 0 Pod::Usage: 0 SOAP::Lite: 0.712 Term::Prompt: 0 Term::ReadKey: 0 URI::Escape: 0 no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 ecaccess-webtoolkit-perl-src-6.3.1/Makefile.PL0100644 0000000 0000000 00000003465 14323263312 017710 0ustar000000000 0000000 use 5.008002; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'ECMWF::ECaccess', VERSION_FROM => 'lib/ECMWF/ECaccess.pm', # finds $VERSION PREREQ_PM => { Getopt::Long => 0, Class::Inspector => 0, Net::HTTP => 0, URI::Escape => 0, Pod::Usage => 0, Term::ReadKey => 0, Term::Prompt => 0, Number::Bytes::Human => 0, MIME::Base64 => 0, IO::Socket::SSL => 0, SOAP::Lite => 1.27 }, ( $] >= 5.005 ? ( ABSTRACT_FROM => 'lib/ECMWF/ECaccess.pm', AUTHOR => 'Laurent Gougeon ' ) : () ), EXE_FILES => [ qw( script/ecaccess script/ecaccess-association-delete script/ecaccess-association-get script/ecaccess-association-list script/ecaccess-association-protocol script/ecaccess-association-put script/ecaccess-certificate-create script/ecaccess-certificate-list script/ecaccess-cosinfo script/ecaccess-ectrans-delete script/ecaccess-ectrans-list script/ecaccess-ectrans-request script/ecaccess-ectrans-restart script/ecaccess-event-clear script/ecaccess-event-create script/ecaccess-event-delete script/ecaccess-event-grant script/ecaccess-event-list script/ecaccess-event-send script/ecaccess-file-chmod script/ecaccess-file-copy script/ecaccess-file-delete script/ecaccess-file-dir script/ecaccess-file-get script/ecaccess-file-mdelete script/ecaccess-file-mget script/ecaccess-file-mkdir script/ecaccess-file-modtime script/ecaccess-file-move script/ecaccess-file-mput script/ecaccess-file-put script/ecaccess-file-rmdir script/ecaccess-file-size script/ecaccess-gateway-connected script/ecaccess-gateway-list script/ecaccess-gateway-name script/ecaccess-job-delete script/ecaccess-job-get script/ecaccess-job-list script/ecaccess-job-restart script/ecaccess-job-submit script/ecaccess-queue-list ) ] ); ecaccess-webtoolkit-perl-src-6.3.1/README0100644 0000000 0000000 00000020625 14323263312 016613 0ustar000000000 0000000 ====================================================================== ECMWF-ECaccess version 6.3.1 ====================================================================== This package provide Perl scripts for the management of files, file transfers, jobs, ectrans associations and events at ECMWF. They can be run by any user and on any Member State host. They use the perl library ECMWF::ECaccess which give access to the ECMWF ECaccess Web Services (or ECaccess API). Running these commands requires a valid certificate. Certificates can be created with the "ecaccess-certificate-create" command from an ECMWF user identifier and a PASSCODE (using a security token), it generates a certificate in ".eccert.crt" in the user's home directory. You need to ensure the following environment variables are set with the correct values: http_ecaccess=gateway.meteo.ms:9080 https_ecaccess=gateway.meteo.ms:9443 (e.g. if your local ECaccess Gateway name is "gateway.meteo.ms" and you are using the default ECaccess http/s ports 9080/9443) If you don't define these variables then the default behaviour is to use the boaccess.ecmwf.int server at ECMWF. 1) INSTALLATION ON UNIX OR MAC-OS-X 2) INSTALLATION ON WINDOWS 3) TEST FAILURE 4) WHAT YOU GET 5) CREATE PACKAGE FOR DISTRIBUTION 6) COPYRIGHT AND LICENCE ====================================================================== 1) INSTALLATION ON UNIX OR MAC-OS-X ====================================================================== A) IF YOU DON'T HAVE ROOT ACCESS -------------------------------- First load the latest release of the local-lib package which can be found at the following place: http://search.cpan.org/dist/local-lib Save the archive in one directory and then from this directory issue the following commands: gunzip local-lib-.tar.gz tar -xf local-lib-.tar cd local-lib- perl Makefile.PL --bootstrap If you have questions that you don't understand just press the Enter key to accept the default values. make make test make install Now you can run the following command: perl -I$HOME/perl5/lib/perl5 -Mlocal::lib This will give you a list of environment parameters to configure in your startupt script (e.g. ~/.bashrc or ~/.cshrc). Logout and login again to get your new environment parameters. Then do the following: perl -MCPAN -eshell cpan[1]> o conf init connect_to_internet_ok urllist cpan[1]> o conf commit cpan[1]> quit Answer yes if prompted the following: "If no urllist has been chosen yet, would you prefer CPAN.pm to connect to the built-in default sites without asking? (yes/no)?" Then answer to the best of your knowledge. You can now skip the following paragraph and go directly to C). B) IF YOU HAVE ROOT ACCESS -------------------------- Login as and go to C). C) INSTALLATION --------------- Please before starting the installation make sure you have OpenSSL installed. More information at the following place: http://www.openssl.org (On Debian systems, you will need to install the libssl-dev package, at least for the duration of the build. It may be removed afterwards) To start the installation of the Webtoolkit, type the following commands to make sure the required Perl Modules are installed (Can't locate object method "install" errors while running these commands should be ignored): perl -MCPAN -e "install Class::Inspector" perl -MCPAN -e "install Getopt::Long" perl -MCPAN -e "install Pod::Usage" perl -MCPAN -e "install Net::HTTP" perl -MCPAN -e "install URI::Escape" perl -MCPAN -e "install Term::ReadKey" perl -MCPAN -e "install Term::ProgressBar" perl -MCPAN -e "install Term::Prompt" perl -MCPAN -e "install Number::Bytes::Human" perl -MCPAN -e "install MIME::Base64" perl -MCPAN -e "install IO::Socket::INET6" perl -MCPAN -e "install IO::Socket::SSL" perl -MCPAN -e "install SOAP::Lite" Then in order to install the ECMWF::ECaccess module, go to the ECMWF-ECaccess directory and type the following: perl Makefile.PL make make test make install ====================================================================== 2) INSTALLATION ON WINDOWS ====================================================================== Install either the StrawberryPerl or the ActivePerl software from the following place: http://strawberryperl.com http://www.activestate.com Then from a Windows Console (Cmd) issue the following commands: perl -MCPAN -e "install Class::Inspector" perl -MCPAN -e "install Getopt::Long" perl -MCPAN -e "install Pod::Usage" perl -MCPAN -e "install Net::HTTP" perl -MCPAN -e "install URI::Escape" perl -MCPAN -e "install Term::ReadKey" perl -MCPAN -e "install Term::Prompt" perl -MCPAN -e "install Number::Bytes::Human" perl -MCPAN -e "install MIME::Base64" perl -MCPAN -e "install Crypt::SSLeay" perl -MCPAN -e "install IO::Socket::INET6" perl -MCPAN -e "install IO::Socket::SSL" perl -MCPAN -e "install SOAP::Lite" Then from the ECMWF install directory: perl Makefile.PL dmake dmake test dmake install Please note the "Term::ProgressBar" Module is not available on Windows, therefore the "-progress" option of the ecaccess-file-get/mget and ecaccess-file-put/mput commands can not be used. ====================================================================== 4) TEST FAILURE ====================================================================== Please note that if your module fails some of its tests you can get more output from the test routines by running: make TEST_VERBOSE=1 test (for Windows replace make by dmake) If you have any problem installing the ECMWF::ECaccess Module then please check the ECaccess pages at the following place: https://confluence.ecmwf.int/x/pw_YAg Or contact us at servicedesk@ecmwf.int. ====================================================================== 5) WHAT YOU GET ====================================================================== After installation the following commands are available: Certificate Management: - ecaccess-certificate-create - ecaccess-certificate-list General Information: - ecaccess-cosinfo Gateway Management: - ecaccess-gateway-connected - ecaccess-gateway-list - ecaccess-gateway-name Association Management: - ecaccess-association-delete - ecaccess-association-get - ecaccess-association-list - ecaccess-association-protocol - ecaccess-association-put ECtrans Management: - ecaccess-ectrans-delete - ecaccess-ectrans-list - ecaccess-ectrans-request - ecaccess-ectrans-restart Event Management: - ecaccess-event-clear - ecaccess-event-create - ecaccess-event-delete - ecaccess-event-grant - ecaccess-event-list - ecaccess-event-send File Management: - ecaccess-file-chmod - ecaccess-file-copy - ecaccess-file-delete - ecaccess-file-dir - ecaccess-file-get - ecaccess-file-mdelete - ecaccess-file-mget - ecaccess-file-mkdir - ecaccess-file-modtime - ecaccess-file-move - ecaccess-file-mput - ecaccess-file-put - ecaccess-file-rmdir - ecaccess-file-size Job Management: - ecaccess-job-delete - ecaccess-job-get - ecaccess-job-list - ecaccess-job-restart - ecaccess-job-submit Queue Management: - ecaccess-queue-list For each command the "-help" option will give you a brief help message and the "-man" option will give you the full documentation. In case of problem you can also use the "-debug" option which will force a dump of the protocol exchanges with your ECaccess Gateway. ====================================================================== 5) CREATE PACKAGE FOR DISTRIBUTION ====================================================================== If you want to create a binary package of your distribution (e.g. for ease of deployement) then you can use the "Makedistrib" script. The required libraries to run this script are the following: perl -MCPAN -e "install PAR" perl -MCPAN -e "install PAR::Packer" perl -MCPAN -e "install Archive::Tar" This will create a compressed file which can be distributed to your users: ecaccess-webtoolkit-bin-6.3.1-.tar.gz ====================================================================== 6) COPYRIGHT AND LICENCE ====================================================================== Copyright (C) 2022 by ECMWF (Laurent.Gougeon@ecmwf.int) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.