Last change
on this file since 83 was
83,
checked in by nanardon, 15 years ago
|
- allow to sync specific object
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id Rev
|
File size:
1.2 KB
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use LATMOS::Accounts; |
---|
6 | use LATMOS::Accounts::Synchro; |
---|
7 | use Getopt::Long; |
---|
8 | use Pod::Usage; |
---|
9 | |
---|
10 | =head1 NAME |
---|
11 | |
---|
12 | la-sync - Tools to synchronize base |
---|
13 | |
---|
14 | =head1 SYNOPSIS |
---|
15 | |
---|
16 | Show configured bases: |
---|
17 | |
---|
18 | la-sync [sync name] [options] |
---|
19 | |
---|
20 | =cut |
---|
21 | |
---|
22 | GetOptions( |
---|
23 | 'c|config=s' => \my $config, |
---|
24 | 'help' => sub { pod2usage(0) }, |
---|
25 | 'from=s' => \my $from, |
---|
26 | 'to=s' => \my @to, |
---|
27 | 'nocreate' => \my $nocreate, |
---|
28 | 'test' => \my $test, |
---|
29 | 'o|object=s' => \my $otype, |
---|
30 | ) or pod2usage(); |
---|
31 | |
---|
32 | =head1 OPTIONS |
---|
33 | |
---|
34 | =item -c|--config configfile |
---|
35 | |
---|
36 | Use this configuration file instead default |
---|
37 | |
---|
38 | =item --from basename |
---|
39 | |
---|
40 | Specify souce base to use |
---|
41 | |
---|
42 | =item --to basename |
---|
43 | |
---|
44 | Specify destination base to use, this option can be used |
---|
45 | severals times |
---|
46 | |
---|
47 | =cut |
---|
48 | |
---|
49 | my $LA = LATMOS::Accounts->new($config); |
---|
50 | |
---|
51 | my $sync = $LA->create_synchro( |
---|
52 | $ARGV[0], |
---|
53 | from => $from, |
---|
54 | to => (@to ? [ @to ] : undef), |
---|
55 | nocreate => $nocreate, |
---|
56 | test => $test, |
---|
57 | ) or die "cannot create sync object\n"; |
---|
58 | $sync->load_dest and return; |
---|
59 | if ($otype) { |
---|
60 | foreach (@ARGV) { |
---|
61 | warn "Try to sync $otype: $_\n"; |
---|
62 | $sync->sync_object($otype, $_); |
---|
63 | } |
---|
64 | } else { |
---|
65 | $sync->process() or warn "Sync has failed\n"; |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.