6 bconsole.pl - Interface between brestore and bweb to use bconsole.
8 You can also use Bconsole.pm and install bconsole on your workstation.
12 Bweb - A Bacula web interface
13 Bacula® - The Network Backup Solution
15 Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
17 The main author of Bweb is Eric Bollengier.
18 The main author of Bacula is Kern Sibbald, with contributions from
19 many others, a complete list can be found in the file AUTHORS.
20 This program is Free Software; you can redistribute it and/or
21 modify it under the terms of version three of the GNU Affero General Public
22 License as published by the Free Software Foundation and included
25 This program is distributed in the hope that it will be useful, but
26 WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28 Affero General Public License for more details.
30 You should have received a copy of the GNU Affero General Public License
31 along with this program; if not, write to the Free Software
32 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
35 Bacula® is a registered trademark of Kern Sibbald.
36 The licensor of Bacula is the Free Software Foundation Europe
37 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
38 Switzerland, email:ftf@fsfeurope.org.
44 use POSIX qw/strftime/;
45 use File::Temp qw/tempfile/;
50 my $conf = new Bweb::Config(config_file => $Bweb::config_file);
53 my $bweb = new Bweb(info => $conf);
54 my $bconsole = new Bconsole(pref => $conf);
55 my $debug = $bweb->{debug};
57 my $opts = $bweb->get_form('timeout');
58 $bconsole->{timeout} = $opts->{timeout} || 40;
60 # on doit utiliser du POST
61 print CGI::header('text/plain');
63 my @action = CGI::param('action') ;
64 my %cmd = ( 'list_job' => '.job',
65 'list_client' => '.client' ,
66 'list_storage' => '.storage',
67 'list_fileset' => '.fileset',
76 my $out = $bconsole->send_cmd($cmd{$a});
80 } elsif ($a eq 'run' and $have_run==0) {
83 my $arg = $bweb->get_form(qw/job client storage fileset regexwhere
84 where replace priority/);
86 my $bootstrap = CGI::param('bootstrap');
88 if (!$bootstrap or !$arg->{job} or !$arg->{client}) {
89 print "ERROR: missing bootstrap or job or client\n";
93 my ($fh, $filename) = tempfile();
94 while (my $l = <$bootstrap>) {
98 chmod(0644, $filename);
100 my $jobid = $bconsole->run(job => $arg->{job},
101 client => $arg->{client},
102 storage => $arg->{storage},
103 fileset => $arg->{fileset},
104 where => $arg->{where},
105 regexwhere => $arg->{regexwhere},
106 # replace => $arg->{replace},
107 priority => $arg->{priority},
108 bootstrap => $filename);
110 print "run=$jobid\n";
113 print STDERR "unknow argument $a\n";