source: LATMOS-Accounts/bin/la-sync @ 83

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
3use strict;
4use warnings;
5use LATMOS::Accounts;
6use LATMOS::Accounts::Synchro;
7use Getopt::Long;
8use Pod::Usage;
9
10=head1 NAME
11
12    la-sync - Tools to synchronize base
13
14=head1 SYNOPSIS
15
16Show configured bases:
17
18    la-sync [sync name] [options]
19
20=cut
21
22GetOptions(
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
36Use this configuration file instead default
37
38=item --from basename
39
40Specify souce base to use
41
42=item --to basename
43
44Specify destination base to use, this option can be used
45severals times
46
47=cut
48
49my $LA = LATMOS::Accounts->new($config);
50
51my $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;
59if ($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.