]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/create_postgresql_database.in
update
[bacula/bacula] / bacula / src / cats / create_postgresql_database.in
1 #!/bin/sh
2 #
3 # shell script to create Bacula database(s)
4 #
5
6 bindir=@SQL_BINDIR@
7 db_name=@db_name@
8
9 # use SQL_ASCII to be able to put any filename into
10 #  the database even those created with unusual character sets
11 ENCODING="ENCODING 'SQL_ASCII'"
12 # use UTF8 if you are using standard Unix/Linux LANG specifications
13 #  that use UTF8 -- this is normally the default and *should* be
14 #  your standard.  Bacula consoles work correctly *only* with UTF8.
15 #ENCODING="ENCODING 'UTF8'"
16      
17
18 if $bindir/psql -f - -d template1 $* <<END-OF-DATA
19 CREATE DATABASE ${db_name} $ENCODING;
20 ALTER DATABASE ${db_name} SET datestyle TO 'ISO, YMD';
21 END-OF-DATA
22 then
23    echo "Creation of ${db_name} database succeeded."
24 else
25    echo "Creation of ${db_name} database failed."
26 fi
27 exit 0