2 # Copyright (c) 2005-2008 Zmanda, Inc. All Rights Reserved.
4 # This library is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU Lesser General Public License version 2.1 as
6 # published by the Free Software Foundation.
8 # This library is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
11 # License for more details.
13 # You should have received a copy of the GNU Lesser General Public License
14 # along with this library; if not, write to the Free Software Foundation,
15 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 # Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
18 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
20 package Amanda::Script;
21 use base qw(Amanda::Script_App);
28 Amanda::Script - perl utility functions for Scripts.
32 package Amanda::Script::my_script;
33 use base qw(Amanda::Script);
37 my ($execute_where, $foo, $bar) = @_;
38 my $self = $class->SUPER::new($execute_where);
39 $self->{'execute_where'} = $execute_where;
40 $self->{'foo'} = $foo;
41 $self->{'bar'} = $bar;
46 # Define all command_* subs that you need, e.g.,
47 sub command_pre_dle_amcheck {
54 # .. parse arguments ..
55 my $script = Amanda::Script::my_script->new($opt_execute_where, $opt_foo, $opt_bar);
62 my $execute_where = shift;
64 my $self = Amanda::Script_App::new($class, $execute_where, "script", @_);
66 $self->{known_commands} = {
69 pre_host_amcheck => 1,
70 post_dle_amcheck => 1,
71 post_host_amcheck => 1,
72 pre_dle_estimate => 1,
73 pre_host_estimate => 1,
74 post_dle_estimate => 1,
75 post_host_estimate => 1,
79 post_host_backup => 1,
82 pre_level_recover => 1,
83 post_level_recover => 1,
84 inter_level_recover => 1,