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-2006 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.
21 This program is Free Software; you can redistribute it and/or
22 modify it under the terms of version two of the GNU General Public
23 License as published by the Free Software Foundation plus additions
24 that are listed in the file LICENSE.
26 This program is distributed in the hope that it will be useful, but
27 WITHOUT ANY WARRANTY; without even the implied warranty of
28 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
29 General Public License for more details.
31 You should have received a copy of the GNU General Public License
32 along with this program; if not, write to the Free Software
33 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
36 Bacula® is a registered trademark of John Walker.
37 The licensor of Bacula is the Free Software Foundation Europe
38 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zurich,
39 Switzerland, email:ftf@fsfeurope.org.
49 use POSIX qw/strftime/;
50 use File::Temp qw/tempfile/;
55 my $conf = new Bweb::Config(config_file => $Bweb::config_file);
58 my $bweb = new Bweb(info => $conf);
59 my $bconsole = new Bconsole(pref => $conf);
60 my $debug = $bweb->{debug};
62 my $opts = $bweb->get_form('timeout');
63 $bconsole->{timeout} = $opts->{timeout} || 40;
65 # on doit utiliser du POST
66 print CGI::header('text/plain');
68 my @action = CGI::param('action') ;
69 my %cmd = ( 'list_job' => '.job',
70 'list_client' => '.client' ,
71 'list_storage' => '.storage',
72 'list_fileset' => '.fileset',
81 my $out = $bconsole->send_cmd($cmd{$a});
85 } elsif ($a eq 'run' and $have_run==0) {
88 my $arg = $bweb->get_form(qw/job client storage fileset
89 where replace priority/);
91 my $bootstrap = CGI::param('bootstrap');
93 if (!$bootstrap or !$arg->{job} or !$arg->{client}) {
94 print "ERROR: missing bootstrap or job or client\n";
98 my ($fh, $filename) = tempfile();
99 while (my $l = <$bootstrap>) {
103 chmod(0644, $filename);
105 my $jobid = $bconsole->run(job => $arg->{job},
106 client => $arg->{client},
107 storage => $arg->{storage},
108 fileset => $arg->{fileset},
109 where => $arg->{where},
110 replace => $arg->{replace},
111 priority => $arg->{priority},
112 bootstrap => $filename);
114 print "run=$jobid\n";
117 print STDERR "unknow argument $a\n";