view release on metacpan or search on metacpan
lib/Backup/Omni/Restore/Filesystem/Single.pm view on Meta::CPAN
my $self = shift;
my $session = '';
my $command = sprintf(COMMAND, OMNIR, $self->host, $self->path, $self->label, $self->session, $self->from, $self->to, $self->target);
my @results = `$command`;
my $rc = $?;
unless (grep(/Restore successfully/, @results)) {
$self->throw_msg(
'backup.omni.restore.filesystem.single.submit',
'nosubmit',
$self->session
);
}
foreach my $line (@results) {
chomp($line);
next if ($line eq '');
lib/Backup/Omni/Restore/Filesystem/Single.pm view on Meta::CPAN
=head1 METHODS
=head2 new
This method will initialize the object. It takes four parameters.
=over 4
=item B<-host>
The name of the host that the backup was performed on.
=item B<-session>
The session id of the backup.
=item B<-target>
The target system to restore the file too.
=item B<-from>
The name of the file to restore.
=item B<-to>
The name of the restored file.
=item B<-path>
The path on the host that was backed up. Defaults to "/archive".
=item B<-label>
The label that was defined for this backup. Defaults to "/archive".
=back
=head2 submit
Submit the restore job to DataProtector. If successful, it will return a
temporary session id, otherwise an exception is thrown.
=head1 SEE ALSO
lib/Backup/Omni/Session/Filesystem.pm view on Meta::CPAN
my $since = db2dt($date);
my $until = $since->clone->add(days => 1);
my $command = sprintf(COMMAND, OMNIDB, $self->host, $self->path, $self->label, $since->ymd('-'), $until->ymd('-'));
my @result = `$command`;
my $rc = $?;
unless (grep(/SessionID/, @result)) {
$self->throw_msg(
'backup.omni.session.filesystem',
'nosession',
$self->host, $self->date
);
}
foreach my $line (@result) {
chomp($line);
next if ($line eq '');
lib/Backup/Omni/Session/Filesystem.pm view on Meta::CPAN
return $self;
}
1;
__END__
=head1 NAME
Backup::Omni::Session::Filesystem - Return a session object for a given backup
=head1 SYNOPSIS
use Backup::Omni::Session::Filesystem;
my $session = Backup::Omni::Session::Filesystem->new(
-host => 'esd189-aix-01',
-date => '2013-01-10'
);
printf("session id = %s\n", $session->sessionid);
=head1 DESCRIPTION
This module will return the session object for a given filesystem backup on a
particular date. It runs the omnidb command with the appropiate options.
If any errors are encounterd, an exception is thrown.
=head1 METHODS
=head2 new
This method will initialze the object. It takes four parameters.
=over 4
=item B<-host>
The name of the host the backup was preformed against.
=item B<-date>
The date the backup was ran. It must be in YYYY-MM-DD format.
=item B<-path>
The path the backup was for. Defaults to '/archive'.
=item B<-label>
The label of the backup. Defaults to '/archive'.
=back
=head2 Session Object
If the session is found an object is returned. That object has the following
methods defined.
=over 4
=item B<sessionid>
This method returns the session id.
=item B<started>
The datetime when the backup started.
=item B<finished>
The datetime when the backup finished.
=item B<object_status>
The status of objec.
=item B<object_size>
The size of the object.
=item B<backup_type>
The type of backup.
=item B<protection>
The protection level of the backup.
=item B<catalog_retention>
The retention period of the backup. It may be the same as the protection.
=item B<version_type>
The version type of the backup.
=item B<access>
The access type of the backup.
=item B<number_of_warnings>
The number of warning generated during this backup.
=item B<number_of_errors>
The number of errors that were generated during this backup.
=item B<device_name>
The name of the device that backup was performed on.
=item B<backup_id>
The id of this backup.
=item B<copy_id>
The copy id of this backup.
=item B<encrypted>
Wither this backup was encrupted.
=back
=head1 SEE ALSO
Backup::Omni::Base
Backup::Omni::Class
Backup::Omni::Utils
Backup::Omni::Constants
Backup::Omni::Exception
lib/Backup/Omni/Session/Messages.pm view on Meta::CPAN
my $self = $class->SUPER::init(@_);
my $command = sprintf(COMMAND, OMNIDB, $self->session, $self->report);
my @result = `$command`;
my $rc = $?;
unless (grep(/Normal/, @result)) {
$self->throw_msg(
'backup.omni.session.messages',
'noresults',
$self->session
);
}
$self->{cur_pos} = 0;
$self->{results} = \@result;
return $self;
lib/Backup/Omni/Session/Monitor.pm view on Meta::CPAN
The object type.
=item B<sessionid>
The original session id for this object.
=item B<restore_started>
The datetime the restore started.
=item B<backup_started>
The datetime the backup started.
=item B<level>
The objects level.
=item B<warnings>
The number of warnings for this object.
=item B<errors>
lib/Backup/Omni/Session/Results.pm view on Meta::CPAN
my $self = $class->SUPER::init(@_);
my $command = sprintf(COMMAND, OMNIDB, $self->session);
my @result = `$command`;
my $rc = $?;
unless (grep(/SessionID/, @result)) {
$self->throw_msg(
'backup.omni.session.results',
'noresults',
$self->session
);
}
foreach my $line (@result) {
chomp($line);
next if ($line eq '');
lib/Backup/Omni/Session/Results.pm view on Meta::CPAN
=head2 Results Object
The results object consists of the following methods:
=over 4
=item B<sessionid>
This method returns the session id.
=item B<backup_specification>
The specifications for the backup.
=item B<session_type>
This method returns the session type.
=item B<started>
The datetime when the backup started.
=item B<finished>
The datetime when the backup finished.
=item B<status>
The status of session.
=item B<number_of_warnings>
The number of warning generated during this session.
=item B<number_of_errors>
lib/Backup/Omni/Utils.pm view on Meta::CPAN
my $parser;
if ($p =~ m/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/) {
$parser = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d %H:%M:%S',
time_zone => 'local',
on_error => sub {
my ($obj, $err) = @_;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.db2dt',
info => sprintf(BADDATE, $err)
);
$ex->throw;
}
);
$dt = $parser->parse_datetime($p);
} else {
my ($package, $file, $line) = caller;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.db2dt',
info => sprintf(BADPARM, $package, $line)
);
$ex->throw;
}
return $dt;
}
lib/Backup/Omni/Utils.pm view on Meta::CPAN
my $ref = ref($p);
if ($ref && $p->isa('DateTime')) {
$parser = DateTime::Format::Strptime->new(
pattern => '%Y-%m-%d %H:%M:%S',
time_zone => 'local',
on_error => sub {
my ($obj, $err) = @_;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.dt2db',
info => sprintf(BADDATE, $err)
);
$ex->throw;
}
);
$ft = $parser->format_datetime($p);
} else {
my ($package, $file, $line) = caller;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.dt2db',
info => sprintf(BADPARM, $package, $line)
);
$ex->throw;
}
return $ft;
}
lib/Backup/Omni/Utils.pm view on Meta::CPAN
my $parser;
if ($p =~ m/\w{3} \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} \w{2} \w{3}/) {
$parser = DateTime::Format::Strptime->new(
pattern => '%a %d %b %Y %r',
time_zone => 'local',
on_error => sub {
my ($obj, $err) = @_;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.omni2dt',
info => sprintf(BADDATE, $err)
);
$ex->throw;
}
);
$dt = $parser->parse_datetime($p);
} else {
my ($package, $file, $line) = caller;
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.omni2dt',
info => sprintf(BADPARM, $package, $line)
);
$ex->throw;
}
return $dt;
}
lib/Backup/Omni/Utils.pm view on Meta::CPAN
if ($session =~ m/^R-/) {
my $command = sprintf(CONVERT, OMNISTAT, $session);
my @result = `$command`;
my $rc = $?;
unless (grep(/SessionID/, @result)) {
my $ex = Backp::Omni::Exception->new(
type => 'backup.omni.utils.convert_id',
info => sprintf(NORESUL, $session)
);
$ex->throw;
}
($id) = split(' ', $result[2]);
} else {
my $ex = Backup::Omni::Exception->new(
type => 'backup.omni.utils.convert_id',
info => BADTEMP
);
$ex->throw;
}
return $id;
}
lib/Backup/Omni/Utils.pm view on Meta::CPAN
sub abort_id {
my $session = shift;
my $command = sprintf(ABORT, OMNIABORT, $session);
my @result = `$command`;
my $rc = $?;
unless (grep(/$session/, @result)) {
my $ex = Backp::Omni::Exception->new(
type => 'backup.omni.utils.abort_id',
info => sprintf(NOABORT, $session)
);
$ex->throw;
}
}
1;