Imported Upstream version 3.3.3
[debian/amanda] / perl / Amanda / Script_App.pm
index 2e6026185da7247892a7027cd70051fb738b66cd..63b7f3c668d969e3307cde6fdadde1b83d76bc04 100644 (file)
@@ -1,9 +1,10 @@
 # vim:ft=perl
-# Copyright (c) 2008,2009 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2008-2012 Zmanda, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -23,6 +24,7 @@ no warnings;
 no strict;
 $GOOD  = 0;
 $ERROR = 1;
+$FAILURE = 2;
 
 use strict;
 use warnings;
@@ -60,6 +62,7 @@ sub new {
        $execute_where = "client";
     }
     Amanda::Util::setup_application($name, $execute_where, $CONTEXT_DAEMON);
+    debug("Arguments: " . join(' ', @ARGV));
 
     #initialize config client to get values from amanda-client.conf
     config_init($CONFIG_INIT_CLIENT, undef);
@@ -116,8 +119,10 @@ sub print_to_server {
     } elsif ($self->{action} eq "backup") {
        if ($status == $Amanda::Script_App::GOOD) {
             print {$self->{mesgout}} "| $msg\n";
-       } else {
+       } elsif ($status == $Amanda::Script_App::ERROR) {
             print {$self->{mesgout}} "? $msg\n";
+       } else {
+            print {$self->{mesgout}} "sendbackup: error $msg\n";
        }
     } elsif ($self->{action} eq "restore") {
         print STDERR "$msg\n";