>       I am having some interesting problems getting amanda 2.5 (or
> 2.4.2p2) to backup a NetApp using the dump wrapper

        I believe I have resolved this problem. It seems that the netapp
dump program has a relatively short timeout on waiting for STDOUT to
unblock. Thus, when piped into restore, as amanda does to create the index,
it gets blocked while restore processes the input. If there are enough files
in the dump or if the CPU is slow or loaded, then dump times out waiting for
restore to finish and dies. In the spirit of amanda, I resolved this by
replacing the restore binary with a simple Perl wrapper that continues to
receive input from dump after restore blocks. I've included this script
below. 

        Seems to work so far :)

-poul

#!/usr/bin/perl
#
# This wrapper for restore opens a child process and redirects STDIN
# to the child in chunks. If the child blocks for more than 1 second,
# we presume the child "is no longer listening" and so continue to receive
# input but stop redirecting. We wait for the the child to exit so the
buffer
# can flush, and when the child finally exits, we also exit.
#
# Poul E.J. Petersen (Rogue Wave Software) 10/12/2001

open CHILD, "|-" or exec "/sbin/_restore @ARGV";

if (1)
{ eval {

        # This alarm will be used to detect when the child blocks.
        # Notice that the "die" only exits this eval loop.

        local $SIG{ALRM}=sub {die "";};

        # This simply reads a line, sets the alarm, prints the
        # line and then clears the alarm. If the alarm doesn't
        # clear, then the child didn't accept input.

        while (<STDIN>) {alarm 3; print CHILD; alarm 0;}

} }

# This handler detects the child exiting and kills us... 

$SIG{CHLD}=sub {exit;};

# Now we continue to recieve input, but we "throw it out" by
# repeadetly  over-writing $_

while (<STDIN>) {}

Reply via email to