2 # Copyright (c) 2008,2009 Zmanda, Inc. All Rights Reserved.
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License version 2 as published
6 # by the Free Software Foundation.
8 # This program 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 General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94085, 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, $config_name) = @_;
64 my $self = Amanda::Script_App::new($class, $execute_where, "script", $config_name);
66 $self->{known_commands} = {
70 pre_host_amcheck => 1,
72 post_dle_amcheck => 1,
73 post_host_amcheck => 1,
74 pre_dle_estimate => 1,
76 pre_host_estimate => 1,
78 post_dle_estimate => 1,
79 post_host_estimate => 1,
85 post_host_backup => 1,
88 pre_level_recover => 1,
89 post_level_recover => 1,
90 inter_level_recover => 1,
99 open ($mesgout_fd, '>&=1') || die("Can't open mesgout_fd: $!");
100 $self->{mesgout} = $mesgout_fd;