Hi Jean-Louis,
>> So as (pre|post)-host-backup can't be executed on the client: What is the
>> best way to stop some services on the client before the first DLE is backed
>> up and restart them after the client has been backed up?
>>
> A solution is to run a script on the server that do rsh/ssh on the client to
> run the command you want.
After your hint I took a closer look at running (pre|post)-host-backup on the
server. It seems that(pre|post)-host-backup gets executed for each DLE which is
not exactly what I need. So I wrote a little perl script (attached) which runs
amdump <config> <server> for each <server> mentioned in the disklist (and
starts/stops the services on the server to be backed up).
This works fine so far, however now each amdump is written to a different tape.
I would like to write all dumps of one night to the same tape (directory in my
case) - what is the recommended solution for that?
Thanks in advance for your answers
Benjamin
#!/usr/bin/perl
use strict;
use warnings;
use IO::File;
use Net::SSH qw(ssh);
use constant AMANDA_BIN_DUMP => '/usr/sbin/amdump';
use constant AMANDA_CONFIG_DIR => '/etc/amanda';
use constant AMANDA_SET_NAME => $ARGV[0] || die "amanda set name missing";
use constant AMANDA_HOST_NAME => $ARGV[1] || undef;
use constant AMANDA_SET_DIR => AMANDA_CONFIG_DIR.'/'.AMANDA_SET_NAME;
use constant INIT_BASE => 'sudo /etc/init.d/';
our $CONF;
require (AMANDA_SET_DIR.'/backup.conf.pm');
my %hosts;
my $fh = new IO::File();
if ($fh->open('< '.AMANDA_SET_DIR.'/disklist')) {
while (my $line = <$fh>) {
if ($line =~ /^([0-9a-zA-Z\.]+?)\s+.*$/g) {
if (!AMANDA_HOST_NAME || ($1 eq AMANDA_HOST_NAME)) {
$hosts{$1} = undef;
}
}
}
$fh->close();
}
foreach my $host (keys %hosts) {
service_ctrl($host, $CONF->{$host}->{services}->{stop}, 'stop');
print $host.': Running amdump... ';
system AMANDA_BIN_DUMP.' '.AMANDA_SET_NAME.' '.$host;
print "done.\n";
service_ctrl($host, $CONF->{$host}->{services}->{start}, 'start');
}
sub service_ctrl {
my ($host, $services, $type) = @_;
foreach my $service (@$services) {
my $cmd = INIT_BASE.$service.' '.$type.' > /dev/null';
print $host.': '.$service.' '.$type.'... ';
ssh($host, $cmd);
print "done.\n";
}
}