1 HELPERS="$HELPERS pgsql:postgresql_database_backup"
4 choose_one_vserver "$pgsql_title"
6 pgsql_vsname="vsname = $REPLY"
11 while [ -z "$REPLY" ]; do
12 formBegin "$pgsql_title: databases"
24 [ $? = 0 ] || return 1
25 pgsql_databases="databases = "
27 [ -n "$i" ] && pgsql_databases="$pgsql_databases $i"
35 pgsql_title="PostgreSQL action wizard"
37 # backup the host system or a Vserver?
38 choose_host_or_one_vserver "$pgsql_title"
39 [ $? = 0 ] || return 1
40 if [ $host_or_vservers == vservers ]; then
42 [ $? = 0 ] || return 1
46 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"
48 pgsql_backupdir="backupdir = $REPLY"
51 booleanBox "$pgsql_title" "Do you want to backup the whole cluster? If not, you'll be offered to choose the databases to backup."
53 pgsql_databases="databases = all"
56 [ $? = 0 ] || return 1
60 booleanBox "$pgsql_title" "Do you want to compress the backups?"
62 pgsql_compress="compress = yes"
64 pgsql_compress="compress = no"
68 get_next_filename $configdirectory/20.pgsql
69 cat >> $next_filename <<EOF
70 ### backupninja PostgreSQL config file ###
72 # vsname = <vserver> (no default)
73 # what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
74 # if you do not specify a vsname the host will be operated on
75 # Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
77 if [ $host_or_vservers == vservers ]; then
78 echo -e "$pgsql_vsname\n" >> $next_filename
81 cat >> $next_filename <<EOF
82 # backupdir = <dir> (default: /var/backups/postgres)
83 # where to dump the backups
86 # databases = < all | db1 db2 db3 > (default = all)
87 # which databases to backup. should either be the word 'all' or a
88 # space separated list of database names.
89 # Note: when using 'all', pg_dumpall is used instead of pg_dump, which means
90 # that cluster-wide data (such as users and groups) are saved.
93 # compress = < yes | no > (default = yes)
94 # if yes, compress the pg_dump/pg_dumpall output.
98 chmod 600 $next_filename