Timo Neuvonen schrieb:
> "James Bowes" <james.bowes AT shaw DOT ca> kirjoitti viestissä
> news:1217175302.7580.4.camel@localhost...
>> Hi.
>>
>> Bacula is producing an error on the RunBefore script which essentially
>> says that it is not parsing the dbname, host and password. Other jobs
>> and clients run fine. here is the error:
>>
>> BeforeJob: run command "/usr/bin/awk
>> -f /etc/bacula/scripts/make_catalog_backup_awk -v
>> cat1=MyCatalog /etc/bacula/bacula-dir.conf"
>> 27-Jul 09:10 archive-dir JobId 385: BeforeJob: mysqldump: Got error:
>> 1045: Access denied for user 'bacula'@'localhost' (using password: NO)
>> when trying to connect
>>
>> I don't understand why it fails though... Is there someplace in the
>> make_catalog_backup_awk script I need to add the credentials?
>>
>
> My *guess* (I'm not using Ubuntu) is that these credentials (especially the
> password) are, or are expected to be, inside the file
> /etc/bacula/scripts/make_catalog_backup_awk
>
Please read this bug report:
https://bugs.launchpad.net/ubuntu/+source/bacula/+bug/227410
I had the same issue. But i can't remember exactly what i did to solve it.
Please have a look at my
make_catalog_backup_awk. This one works fine here.
Regards,
Christian
#!/usr/bin/gawk -f
# extract.awk script expects Catalog definition in a form of:
# Catalog {
# Name = NameOfCatalog
# dbname = ""; DB Address = ""; user = ""; password = ""; DB Socket = "";
DB Port = ""
# }
#
BEGIN { RS= "}" ; FS="[;\n]+"}
function trim(v) {
## Remove leading and trailing spaces
sub(/^ */,"",v)
sub(/ *$/,"",v)
return v
}
$0 ~ /Catalog[[:space:]]*{/ {
for ( i = 1; i <= NF ; i++)
{
split($i,a,"=")
if (a[1] ~ /dbname/)
dbname = trim(gensub("\"","","g",a[2])) # remove " char
if (a[1] ~ /user/)
user = trim(gensub("\"","","g",a[2]))
if (a[1] ~ /Name/)
catname = trim(gensub("\"","","g",a[2]))
if (a[1] ~ /password/)
password = trim(gensub("\"","","g",a[2]))
if (a[1] ~ /DB Address/)
dbaddress = trim(gensub("\"","","g",a[2]))
if (a[1] ~ /DB Socket/)
dbsocket = trim(gensub("\"","","g",a[2]))
if (a[1] ~ /DB Port/)
dbport = trim(gensub("\"","","g",a[2]))
}
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"
system(sprintf ("HOME=/var/lib/bacula mysqldump %s >
/var/lib/bacula/bacula.sql",dbname))
}
}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|