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

Last change on this file since 494 was 457, checked in by nanardon, 15 years ago
  • add options to not load acls, command line tools are superuser command, then skip acls checks
  • Property svn:executable set to *
  • Property svn:keywords set to Id Rev
File size: 1.3 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    's|syncname=s' => \my $syncname,
31) or pod2usage();
32
33=head1 OPTIONS
34
35=item -c|--config configfile
36
37Use this configuration file instead default
38
39=item --from basename
40
41Specify souce base to use
42
43=item --to basename
44
45Specify destination base to use, this option can be used
46severals times
47
48=cut
49
50my $LA = LATMOS::Accounts->new($config, noacl => 1);
51
52my $sync = $LA->create_synchro(
53    $syncname,
54    from => $from,
55    to => (@to ? [ @to ] : undef),
56    nocreate => $nocreate,
57    test     => $test,
58) or die "cannot create sync object\n";
59$sync->load_dest and return;
60if ($otype) {
61    foreach (@ARGV) {
62        warn "Try to sync $otype: $_\n";
63        $sync->sync_object($otype, $_) or do {
64            warn "Error while synching $_ ($otype)\n";
65            exit 1;
66        }
67    }
68} else {
69    $sync->process() or warn "Sync has failed\n";
70}
71
72exit 0;
Note: See TracBrowser for help on using the repository browser.