When logged on as root, I can run the following script to backup my MySQL
databases to a local folder:

#!/bin/bash

BACKUPLOCATION=/var/local/mysqlbackups
LOGFILE=/usr/local/sbin/backupdbs.log
GZIP="$(which gzip)"
NOW=$(date +"%d-%m-%Y")
RETENTION=30
#remove .gz files greater than 30 days old
find /var/local/mysqlbackups -mtime +$RETENTION -exec rm -fr {} \; &>
/dev/null
# back up all the mysql databases, into individual files so we can later
restore
# them separately if needed.
mysql --defaults-extra-file=/root/.my.cnf -B -N -e "show databases" | while
read db
do
   BACKUPFILE=$BACKUPLOCATION/mysql-${db}.${NOW}-$(date +"%T").gz
   echo "Backing up $db into $BACKUPFILE"
   /usr/bin/mysqldump --defaults-extra-file=/root/.my.cnf
--single-transaction $db | $GZIP -9 > $BACKUPFILE
done >>$LOGFILE

However, when I run the backup from bacula, I get the following error
message...

*The backup job is now running. When complete, the results will be shown
below ..*

05-Apr 16:18 cablemon-dir JobId 27: shell command: run BeforeJob
"/usr/local/sbin/backupdbs"
05-Apr 16:18 cablemon-dir JobId 27: BeforeJob: Could not open required
defaults file: /root/.my.cnf
05-Apr 16:18 cablemon-dir JobId 27: BeforeJob: Fatal error in defaults
handling. Program aborted
05-Apr 16:18 cablemon-dir JobId 27: BeforeJob: ERROR 1045 (28000):
Access denied for user 'bacula'@'localhost' (using password: NO)
05-Apr 16:18 cablemon-dir JobId 27: Start Backup JobId 27,
Job=BackupClient1.2012-04-05_16.18.54_33
05-Apr 16:18 cablemon-dir JobId 27: Using Device "FileStorage"
05-Apr 16:18 cablemon-sd JobId 27: Volume "Inc-0002" previously
written, moving to end of data.
05-Apr 16:18 cablemon-sd JobId 27: Ready to append to end of Volume
"Inc-0002" size=67985900
05-Apr 16:18 cablemon-fd JobId 27:      Could not stat
"/usr/sbin/local": ERR=No such file or directory
05-Apr 16:18 cablemon-sd JobId 27: Job write elapsed time = 00:00:01,
Transfer rate = 0  Bytes/second
05-Apr 16:18 cablemon-dir JobId 27: Bacula cablemon-dir 5.0.1
(24Feb10): 05-Apr-2012 16:18:57


The backup finishes ok, just not the script component. I first gave
read access to /root/.my.cnf for the account "bacula", but I still got
the error. I even set the permissions as 777 for .my.cnf and still I
got the above error. I am using the .my.cnf file to hide the mysql
username and password.
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to