#!/usr/bin/perl use strict; use warnings; use LATMOS::Accounts; use LATMOS::Accounts::Synchro; use Getopt::Long; use Pod::Usage; =head1 NAME la-sync - Tools to synchronize base =head1 SYNOPSIS Show configured bases: la-sync [sync name] [options] =cut GetOptions( 'c|config=s' => \my $config, 'help' => sub { pod2usage(0) }, 'from=s' => \my $from, 'to=s' => \my @to, 'nocreate' => \my $nocreate, 'test' => \my $test, 'o|object=s' => \my $otype, 's|syncname=s' => \my $syncname, ) or pod2usage(); =head1 OPTIONS =item -c|--config configfile Use this configuration file instead default =item --from basename Specify souce base to use =item --to basename Specify destination base to use, this option can be used severals times =cut my $LA = LATMOS::Accounts->new($config, noacl => 1); my $sync = $LA->create_synchro( $syncname, from => $from, to => (@to ? [ @to ] : undef), nocreate => $nocreate, test => $test, ) or die "cannot create sync object\n"; $sync->load_dest and return; if ($otype) { foreach (@ARGV) { warn "Try to sync $otype: $_\n"; $sync->sync_object($otype, $_) or do { warn "Error while synching $_ ($otype)\n"; exit 1; } } } else { $sync->process() or warn "Sync has failed\n"; } exit 0;