1 HELPERS="$HELPERS pgsql:postgresql_database_backup"
4 choose_one_vserver "$pgsql_title"
6 pgsql_vsname="vsname = $REPLY"
10 formBegin "$pgsql_title: databases"
24 pgsql_databases="databases = "
26 [ "$i" != "" ] && pgsql_databases="$pgsql_databases $i"
33 pgsql_title="PostgreSQL action wizard"
35 # backup the host system or a Vserver?
36 choose_host_or_one_vserver "$pgsql_title"
37 [ $? = 0 ] || return 1
38 if [ $host_or_vservers == vservers ]; then
40 [ $? = 0 ] || return 1
44 inputBox "$pgsql_title" "Directory where to store the backups:`[ -z \"$pgsql_vsname\" ] || echo \"\n(In respect to chosen vserver's root directory)\"`" "/var/backups/postgres"
46 pgsql_backupdir="backupdir = $REPLY"
49 booleanBox "$pgsql_title" "Do you want to backup the whole cluster? If not, you'll be offered to choose the databases to backup."
51 pgsql_databases="databases = all"
54 [ $? = 0 ] || return 1
58 booleanBox "$pgsql_title" "Do you want to compress the backups?"
60 pgsql_compress="compress = yes"
62 pgsql_compress="compress = no"
66 get_next_filename $configdirectory/20.pgsql
67 cat >> $next_filename <<EOF
68 ### backupninja PostgreSQL config file ###
70 # vsname = <vserver> (no default)
71 # what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
72 # if you do not specify a vsname the host will be operated on
73 # Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
75 if [ $host_or_vservers == vservers ]; then
76 echo -e "$pgsql_vsname\n" >> $next_filename
79 cat >> $next_filename <<EOF
80 # backupdir = <dir> (default: /var/backups/postgres)
81 # where to dump the backups
84 # databases = < all | db1 db2 db3 > (default = all)
85 # which databases to backup. should either be the word 'all' or a
86 # space separated list of database names.
87 # Note: when using 'all', pg_dumpall is used instead of pg_dump, which means
88 # that cluster-wide data (such as users and groups) are saved.
91 # compress = < yes | no > (default = yes)
92 # if yes, compress the pg_dump/pg_dumpall output.
96 chmod 600 $next_filename