3 # shell script to create Bacula database(s)
10 # use SQL_ASCII to be able to put any filename into
11 # the database even those created with unusual character sets
12 ENCODING="ENCODING 'SQL_ASCII'"
15 # Please note: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 # We do not recommend that you use ENCODING 'SQL_UTF8'
17 # It can result in creating filenames in the database that
18 # cannot be seen or restored.
19 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22 if $bindir/psql -f - -d template1 $* <<END-OF-DATA
24 CREATE DATABASE ${db_name} $ENCODING TEMPLATE template0;
25 ALTER DATABASE ${db_name} SET datestyle TO 'ISO, YMD';
28 echo "Creation of ${db_name} database succeeded."
31 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
32 echo "!!!! Creation of ${db_name} database failed. !!!!"
33 echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
35 if $bindir/psql -l ${dbname} | grep " ${db_name}.*SQL_ASCII" >/dev/null; then
36 echo "Database encoding OK"
39 echo "Database encoding bad. Do not use this database"