Dakota -
bareos-fd runs as 'root' because it requires access to all files for backup.
bareos-sd and bareos-dir should both be running as 'bareos'.
My job definition ......
Job {
Name = DR-ConsBugFixes
JobDefs = DefaultJob
Client = qco-util-fd
Type = Admin
Priority = 30
Schedule = AdminBugFixSched
Enabled = yes
Run Script {
Runs on Success = Yes
Runs on Failure = Yes
Runs on Client = No
Runs When = Before
Fail Job On Error = Yes
Command = "/etc/bareos/bareos-dir.d/job/scripts/drConsBugFixes.sh"
}
}
My script file ......
#!/bin/bash
# grab the database credentials from existing configuration files
catalogFile=`find /etc/bareos/bareos-dir.d/catalog/ -type f`
dbUser=`grep dbuser $catalogFile | grep -o '".*"' | sed 's/"//g'`
dbPwd=`grep dbpassword $catalogFile | grep -o '".*"' | sed 's/"//g'`
# Make sure all DR-Copy jobs that are in the FileCopy pool are properly set in
the database as Copy (C) jobs. This is to work around a Bareos bug where
consolidation removes a job and Bareos promotes the Copy job to a Backup (B)
job. That 'copy' job then gets consolidated a second time and copied again.
/usr/bin/mysql bareos -u $dbUser -p$dbPwd -se "UPDATE Job J SET J.Type = 'C'
WHERE J.Type <> 'C' AND EXISTS (SELECT 1 FROM Media M, JobMedia JM WHERE
JM.JobId = J.JobId AND M.MediaId = JM.MediaID AND M.MediaType = 'FileCopy');"
# Get a list of volumes no longer in use and submit them to the console for
pruning. This is to work around a bug where Bareos does not prune volumes
after a Consolidate action.
# Query for a list of volumes (exclude DR copy volumes)
emptyVols=$(mysql bareos -u $dbUser -p$dbPwd -se "SELECT m.VolumeName FROM
bareos.Media m where m.MediaType <> 'FileCopy' and m.VolStatus not in
('Append','Purged') and not exists (select 1 from bareos.JobMedia jm where
jm.MediaId=m.MediaId);")
# Submit volumes to bconsole for pruning
for volName in $emptyVols
do
poolName=$(mysql bareos -u $dbUser -p$dbPwd -se "SELECT p.Name FROM bareos.Pool
p where p.PoolId = (select m.PoolId from bareos.Media m where
m.VolumeName='$volName');")
storageName=$(mysql bareos -u $dbUser -p$dbPwd -se "SELECT s.Name FROM
bareos.Storage s where s.StorageId = (select m.StorageId from bareos.Media m
where m.VolumeName='$volName');")
/bin/bconsole << EOD
purge volume=$volName action=Truncate pool=$poolName storage=$storageName yes
$emptyVol
quit
EOD
done
exit
--
You received this message because you are subscribed to the Google Groups
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.