|
|
@ -59,6 +59,9 @@ if ( $can_snapshot ) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ( $opt->{pre} ) { |
|
|
|
if ( $opt->{pre} ) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
my $failure = 0; |
|
|
|
|
|
|
|
|
|
|
|
if ($opt->{shutdown} =~ m/^no(ne)?/){ |
|
|
|
if ($opt->{shutdown} =~ m/^no(ne)?/){ |
|
|
|
log_info("Not shutting down any service"); |
|
|
|
log_info("Not shutting down any service"); |
|
|
|
} elsif ($opt->{shutdown} eq 'ldap' and -e '/opt/zimbra/bin/ldap'){ |
|
|
|
} elsif ($opt->{shutdown} eq 'ldap' and -e '/opt/zimbra/bin/ldap'){ |
|
|
@ -91,11 +94,13 @@ if ( $opt->{pre} ) { |
|
|
|
|
|
|
|
|
|
|
|
# Take the snapshot |
|
|
|
# Take the snapshot |
|
|
|
if ( system( "lvcreate $snap_args $dev") != 0 ) { |
|
|
|
if ( system( "lvcreate $snap_args $dev") != 0 ) { |
|
|
|
die "Failed to create snapshot\n"; |
|
|
|
log_info("Failed to create snapshot"); |
|
|
|
|
|
|
|
# Record the failure but don't die now, we need to restart services |
|
|
|
|
|
|
|
$failure = 1; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
log_info("snapshot created as $dev" . '_bkp'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
log_info("snapshot created as $dev" . '_bkp'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Restart Zimbra now to minimize down time |
|
|
|
# Restart Zimbra now to minimize down time |
|
|
|
if ($opt->{shutdown} =~ m/^no(ne)?/){ |
|
|
|
if ($opt->{shutdown} =~ m/^no(ne)?/){ |
|
|
|
log_info("No service were shutted down"); |
|
|
|
log_info("No service were shutted down"); |
|
|
@ -124,6 +129,10 @@ if ( $opt->{pre} ) { |
|
|
|
system('systemctl start zimbra'); |
|
|
|
system('systemctl start zimbra'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($failure){ |
|
|
|
|
|
|
|
die "Stoping backup process now, as snapshot failed\n"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Now mount the snapshot RO |
|
|
|
# Now mount the snapshot RO |
|
|
|
my $mount_args = "-o ro -t $fs"; |
|
|
|
my $mount_args = "-o ro -t $fs"; |
|
|
|
if ( $fs eq 'xfs' ) { |
|
|
|
if ( $fs eq 'xfs' ) { |
|
|
|