#!/bin/bash
#
# Bacula storage maintenance scripts
# Grant privileges to the Bacula MySQL database
#

if /usr/bin/mysql $* -u root -f <<END-OF-DATA
use mysql
grant all privileges on bacula.* to bacula@localhost;
grant all privileges on bacula.* to bacula@"%";
select * from user;
flush privileges;
END-OF-DATA
then
   echo "Privileges for bacula granted on @db_name."
   exit 0
else
   echo "Error creating privileges."
   exit 1
fi
