Commit 54299532 authored by Andy Yates's avatar Andy Yates
Browse files

Giving this the option to specify the default location which should help when...

Giving this the option to specify the default location which should help when using these. Also switch to env perl and used warnings explicitly rather than rely on #! lines
parent 8253d5ea
#!/usr/local/ensembl/bin/perl -w #!/usr/bin/env perl
########################################## ##########################################
# #
# Simple but handy script that generate the input file # Simple but handy script that generate the input file
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# #
######################################### #########################################
use strict; use strict;
use warnings;
use DBI; use DBI;
use Getopt::Long; use Getopt::Long;
...@@ -22,6 +23,7 @@ my $sourcePwd=""; ...@@ -22,6 +23,7 @@ my $sourcePwd="";
my $destinationHost="mart2"; my $destinationHost="mart2";
my $destinationPort="3306"; my $destinationPort="3306";
my $limit=''; my $limit='';
my $target_location = '';
my $usage = "\nUsage: $0 -sourceHost mart1 -sourceUser xxx -destinationHost mart2 -limit %42%\n my $usage = "\nUsage: $0 -sourceHost mart1 -sourceUser xxx -destinationHost mart2 -limit %42%\n
-help or -h [for help] -help or -h [for help]
...@@ -31,7 +33,8 @@ my $usage = "\nUsage: $0 -sourceHost mart1 -sourceUser xxx -destinationHost mart ...@@ -31,7 +33,8 @@ my $usage = "\nUsage: $0 -sourceHost mart1 -sourceUser xxx -destinationHost mart
-sourceUser [default: ] -sourceUser [default: ]
-destinationHost [default: mart2 ] -destinationHost [default: mart2 ]
-destinationPort [default: 3306 ] -destinationPort [default: 3306 ]
-limit [eg. %core_42% ]\n -limit [eg. %core_42% ]
-target_location [default: blank if you want standard data locations]\n
The limit option will limit the databases being copied according to your limit criteria. The limit option will limit the databases being copied according to your limit criteria.
With -limit %core_42% only ensembl core 42 databases will be copied\n\n With -limit %core_42% only ensembl core 42 databases will be copied\n\n
...@@ -44,6 +47,7 @@ GetOptions('help|h' => \$help, ...@@ -44,6 +47,7 @@ GetOptions('help|h' => \$help,
'sourcePwd=s' => \$sourcePwd, 'sourcePwd=s' => \$sourcePwd,
'destinationHost=s' => \$destinationHost, 'destinationHost=s' => \$destinationHost,
'destinationPort=s' => \$destinationPort, 'destinationPort=s' => \$destinationPort,
'target_location=s' => \$target_location,
'limit=s' => \$limit); 'limit=s' => \$limit);
if ($help || scalar @ARGV == 0 ) { if ($help || scalar @ARGV == 0 ) {
...@@ -71,7 +75,7 @@ $sth->execute( ); ...@@ -71,7 +75,7 @@ $sth->execute( );
while ( my @row = $sth->fetchrow ){ while ( my @row = $sth->fetchrow ){
my $result = sprintf ("%s %d %50s %s %d %s",$sourceHost.".internal.sanger.ac.uk", $sourcePort, $row[0], $destinationHost.".internal.sanger.ac.uk ", $destinationPort, $row[0]); my $result = sprintf ("%s %d %50s %s %d %s",$sourceHost.".internal.sanger.ac.uk", $sourcePort, $row[0], $destinationHost.".internal.sanger.ac.uk ", $destinationPort, $row[0]);
$result .= " $target_location" if $target_location;
print $result . "\n"; print $result . "\n";
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment