fade2gray
September 23rd, 2008, 08:33 PM
If you are unable to perform backups with the Webmin 'Bacula Backup System' module because of missing buttons etc. in 'Backup Jobs > Edit Backup Job', or because of an incomplete form in 'Run Backup Job', e.g. ...
http://lh5.ggpht.com/fade2gray.uk/SNl9nniVVwI/AAAAAAAAAHg/7AC1nr6hfCE/s144/webmin_bacula.jpg (http://picasaweb.google.co.uk/fade2gray.uk/Webmin?authkey=z9a-5vsimcM#5249364960258381570)
Make the following edits ...
Comment out the line &close_console($h); in ...
/usr/share/webmin/bacula-backup/bacula-backup-lib.pl
# get_bacula_jobs()
# Returns a list of all jobs known to Bacula
sub get_bacula_jobs
{
local $h = &open_console();
local $jobs = &console_cmd($h, "show jobs");
# COMMENT OUT &close_console($h);
local @rv;
local $job;
foreach my $l (split(/\r?\n/, $jobs)) {
if ($l =~ /^Job:\s+name=([^=]*\S)\s/) {
$job = { 'name' => $1 };
push(@rv, $job);
}
elsif ($l =~ /Client:\s+name=([^=]*\S)\s/ && $job) {
$job->{'client'} = $1;
}
elsif ($l =~ /FileSet:\s+name=([^=]*\S)\s/ && $job) {
$job->{'fileset'} = $1;
}
}
return @rv;
}
Add the lines of code where indicated in ...
/usr/share/webmin/bacula-backup/backup_form.cgi
[...]
print &ui_table_end();
print &ui_form_end([ [ "backup", $text{'backup_ok'} ] ]);
local $h = &open_console(); # CODE ADDED
&close_console($h); # CODE ADDED
&ui_print_footer("", $text{'index_return'});
and in ...
/usr/share/webmin/bacula-backup/edit_job.cgi
[...]
else {
($bjob) = grep { $_->{'name'} eq $in{'name'} } &get_bacula_jobs();
print &ui_form_end([ [ "save", $text{'save'} ],
( $job->{'name'} eq 'Job' && $bjob ?
( [ "run", $text{'job_run'} ] ) : ( ) ),
[ "delete", $text{'delete'} ] ]);
}
local $h = &open_console(); # CODE ADDED
&close_console($h); # CODE ADDED
&ui_print_footer("list_jobs.cgi", $text{'jobs_return'});
Also, if you get an error along the lines of "bacula@localhost password=NO" when trying to run the backup job "BackupCatalog" (backup appears to complete suscessfully, but on restore produces a zero byte "bacula.sql" file), try the following edit.
Edit the line of code where indicated in ...
/etc/bacula/scripts/make_catalog_backup_awk
[...]
if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4) {
if (dbaddress == "") #Not optional in the case of MySQL
dbaddress = "localhost"
system("rm -rf /var/lib/bacula/.my.cnf")
system("touch /var/lib/bacula/.my.cnf")
system("chmod 600 /var/lib/bacula/.my.cnf")
printf "[client]\n host=%s\n user=%s\n password=%s\n",dbaddress,user,password >> "/var/lib/bacula/.my.cnf"
if (dbport != "")
printf " port=%s\n",dbport >> "/var/lib/bacula/.my.cnf"
if (dbsocket != "")
printf " socket=%s\n",dbsocket >> "/var/lib/bacula/.my.cnf"
# CHANGE THIS system(sprintf ("mysqldump %s > /var/lib/bacula/bacula.sql",dbname))
system(sprintf ("mysqldump --defaults-file=/var/lib/bacula/.my.cnf %s > /var/lib/bacula/bacula.sql",dbname)) # FOR THIS
}
[...]
HTH.
http://lh5.ggpht.com/fade2gray.uk/SNl9nniVVwI/AAAAAAAAAHg/7AC1nr6hfCE/s144/webmin_bacula.jpg (http://picasaweb.google.co.uk/fade2gray.uk/Webmin?authkey=z9a-5vsimcM#5249364960258381570)
Make the following edits ...
Comment out the line &close_console($h); in ...
/usr/share/webmin/bacula-backup/bacula-backup-lib.pl
# get_bacula_jobs()
# Returns a list of all jobs known to Bacula
sub get_bacula_jobs
{
local $h = &open_console();
local $jobs = &console_cmd($h, "show jobs");
# COMMENT OUT &close_console($h);
local @rv;
local $job;
foreach my $l (split(/\r?\n/, $jobs)) {
if ($l =~ /^Job:\s+name=([^=]*\S)\s/) {
$job = { 'name' => $1 };
push(@rv, $job);
}
elsif ($l =~ /Client:\s+name=([^=]*\S)\s/ && $job) {
$job->{'client'} = $1;
}
elsif ($l =~ /FileSet:\s+name=([^=]*\S)\s/ && $job) {
$job->{'fileset'} = $1;
}
}
return @rv;
}
Add the lines of code where indicated in ...
/usr/share/webmin/bacula-backup/backup_form.cgi
[...]
print &ui_table_end();
print &ui_form_end([ [ "backup", $text{'backup_ok'} ] ]);
local $h = &open_console(); # CODE ADDED
&close_console($h); # CODE ADDED
&ui_print_footer("", $text{'index_return'});
and in ...
/usr/share/webmin/bacula-backup/edit_job.cgi
[...]
else {
($bjob) = grep { $_->{'name'} eq $in{'name'} } &get_bacula_jobs();
print &ui_form_end([ [ "save", $text{'save'} ],
( $job->{'name'} eq 'Job' && $bjob ?
( [ "run", $text{'job_run'} ] ) : ( ) ),
[ "delete", $text{'delete'} ] ]);
}
local $h = &open_console(); # CODE ADDED
&close_console($h); # CODE ADDED
&ui_print_footer("list_jobs.cgi", $text{'jobs_return'});
Also, if you get an error along the lines of "bacula@localhost password=NO" when trying to run the backup job "BackupCatalog" (backup appears to complete suscessfully, but on restore produces a zero byte "bacula.sql" file), try the following edit.
Edit the line of code where indicated in ...
/etc/bacula/scripts/make_catalog_backup_awk
[...]
if (catname == cat1 || catname == cat2 || catname == cat3 || catname == cat4) {
if (dbaddress == "") #Not optional in the case of MySQL
dbaddress = "localhost"
system("rm -rf /var/lib/bacula/.my.cnf")
system("touch /var/lib/bacula/.my.cnf")
system("chmod 600 /var/lib/bacula/.my.cnf")
printf "[client]\n host=%s\n user=%s\n password=%s\n",dbaddress,user,password >> "/var/lib/bacula/.my.cnf"
if (dbport != "")
printf " port=%s\n",dbport >> "/var/lib/bacula/.my.cnf"
if (dbsocket != "")
printf " socket=%s\n",dbsocket >> "/var/lib/bacula/.my.cnf"
# CHANGE THIS system(sprintf ("mysqldump %s > /var/lib/bacula/bacula.sql",dbname))
system(sprintf ("mysqldump --defaults-file=/var/lib/bacula/.my.cnf %s > /var/lib/bacula/bacula.sql",dbname)) # FOR THIS
}
[...]
HTH.