Changeset 18390 for trunk/Nebulous/bin/neb-replicate
- Timestamp:
- Jun 30, 2008, 2:35:11 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Nebulous/bin/neb-replicate (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/bin/neb-replicate
r16183 r18390 3 3 # Copyright (C) 2007-2008 Joshua Hoblitt 4 4 # 5 # $Id: neb-replicate,v 1. 1 2008-01-22 22:10:27jhoblitt Exp $5 # $Id: neb-replicate,v 1.2 2008-07-01 00:35:11 jhoblitt Exp $ 6 6 7 7 use strict; … … 9 9 10 10 use vars qw( $VERSION ); 11 $VERSION = '0.0 1';11 $VERSION = '0.02'; 12 12 13 13 use Nebulous::Client; … … 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($server, $volume); 18 my ($server, $volume, $copies); 19 $copies = 1; # default to making just one copy 19 20 20 21 $server = $ENV{'NEB_SERVER'} unless $server; … … 23 24 'server|s=s' => \$server, 24 25 'volume|v=s' => \$volume, 26 'copies|c=i' => \$copies, 25 27 ) || pod2usage( 2 ); 26 28 … … 32 34 pod2usage( -msg => "missing key", exitval => 2 ) 33 35 unless defined $key; 36 pod2usage( -msg => "--copies must be > 0", exitval => 2 ) 37 unless $copies > 0; 34 38 35 39 my $neb = Nebulous::Client->new( … … 40 44 unless defined $neb; 41 45 42 if (defined $volume) { 43 $neb->replicate($key, $volume) 44 or die "failed to replicate Nebulous key: $key"; 45 } else { 46 $neb->replicate($key) 47 or die "failed to replicate Nebulous key: $key"; 46 for (my $i = 0; $i < $copies; $i++) { 47 if (defined $volume) { 48 $neb->replicate($key, $volume) 49 or die "failed to replicate Nebulous key: $key"; 50 } else { 51 $neb->replicate($key) 52 or die "failed to replicate Nebulous key: $key"; 53 } 48 54 } 49 55 … … 59 65 =head1 SYNOPSIS 60 66 61 neb-replicate [--server <URL>] [--volume <volume name>] <key> 67 neb-replicate [--server <URL>] [--volume <volume name>] 68 [--copies <n>] <key> 62 69 63 70 =head1 DESCRIPTION … … 81 88 82 89 Optional. 90 91 =item * --copies|c <n> 92 93 The number of new replications to create. 94 95 Optional. Defaults to 0. 83 96 84 97 =back
Note:
See TracChangeset
for help on using the changeset viewer.
