Paul Bijnens wrote:
An example of a wrapper on the client...
Set the exitcodes correct too!

Here is an untested example.


#!/usr/bin/perl


use Getopt::Long qw(:config pass_through);

$result = GetOptions (
                'directory=s' => \$dir,
                'file=s' => \$file,
                );

$post = 0;
if ($dir eq '/my/special_dir' &&  $file ne '/dev/null') {
    system '/usr/bin/dbshut thedb >/tmp/amanda/dbshut.debug 2>&1';
    # avoid output to stdout!!! stdout fd = the backup image
    # msgs on stderr will be flagged as "strange" in amreport
    # so you could leave out the 2>&1
    $post = 1;
}

# put all options we processed back
unshift(@ARGV, '--directory', $dir);
unshift(@ARGV, '--file', $file;

# now put the real gnutar program in front
unshift(@ARGV, "/usr/local/bin/gtar");

$rc = $? >> 8;



system @ARGV ; # and run it


if ($post) {  # need postprocessing?
    system '/usr/bin/dbstart thedb >/tmp/amanda/dbstart.debug 2>&1';
}

exit $rc;



-- Paul Bijnens, Xplanation Tel +32 16 397.511 Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512 http://www.xplanation.com/ email: [EMAIL PROTECTED] *********************************************************************** * I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, F6, * * quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, * * stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, * * PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, * * kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... * * ... "Are you sure?" ... YES ... Phew ... I'm out * ***********************************************************************




Reply via email to