2 # Copyright (c) 2008-2012 Zmanda, Inc. All Rights Reserved.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19 # Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
21 package Amanda::Script;
22 use base qw(Amanda::Script_App);
29 Amanda::Script - perl utility functions for Scripts.
33 package Amanda::Script::my_script;
34 use base qw(Amanda::Script);
38 my ($execute_where, $foo, $bar) = @_;
39 my $self = $class->SUPER::new($execute_where);
40 $self->{'execute_where'} = $execute_where;
41 $self->{'foo'} = $foo;
42 $self->{'bar'} = $bar;
47 # Define all command_* subs that you need, e.g.,
48 sub command_pre_dle_amcheck {
55 # .. parse arguments ..
56 my $script = Amanda::Script::my_script->new($opt_execute_where, $opt_foo, $opt_bar);
63 my ($execute_where, $config_name) = @_;
65 my $self = Amanda::Script_App::new($class, $execute_where, "script", $config_name);
67 $self->{known_commands} = {
71 pre_host_amcheck => 1,
73 post_dle_amcheck => 1,
74 post_host_amcheck => 1,
75 pre_dle_estimate => 1,
77 pre_host_estimate => 1,
79 post_dle_estimate => 1,
80 post_host_estimate => 1,
86 post_host_backup => 1,
89 pre_level_recover => 1,
90 post_level_recover => 1,
91 inter_level_recover => 1,
100 open ($mesgout_fd, '>&=1') || die("Can't open mesgout_fd: $!");
101 $self->{mesgout} = $mesgout_fd;