bindir=@SQL_BINDIR@
PATH="$bindir:$PATH"
-db_name=@db_name@
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
# use SQL_ASCII to be able to put any filename into
# the database even those created with unusual character sets
#
#ENCODING="ENCODING 'UTF8'"
-if createdb $* ${db_name}
+if createdb -u${db_user} $* ${db_name}
then
echo "Creation of ${db_name} database succeeded."
else
#
bindir=@SQL_BINDIR@
-db_name=@db_name@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
-if destroydb ${db_name}
+if destroydb -u${db_user} ${db_name}
then
echo "Drop of ${db_name} database succeeded."
else
# shell script to delete Bacula tables for PostgreSQL
bindir=@SQL_BINDIR@
-db_name=@db_name@
-db_user=@db_user@
+PATH="$bindir:$PATH"
+db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
sql -u${db_user} ${db_name} $* <<END-OF-DATA
DROP TABLE filename\g
# shell script TO GRANT privileges to the bacula database
#
bindir=@SQL_BINDIR@
+PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
db_user=${db_user:-@db_user@}
\g
END-OF-DATA
-if sql ${db_name} $* <<END-OF-DATA
+if sql -u${db_user} ${db_name} $* <<END-OF-DATA
-- for tables
GRANT ALL ON TABLE filename TO ${db_user};
bindir=@SQL_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
+db_user=${db_user:-@db_user@}
-sql $* ${db_name} <<END-OF-DATA
+sql -u${db_user} $* ${db_name} <<END-OF-DATA
SET AUTOCOMMIT ON\g