Added helper for pgsql handler.

This commit is contained in:
intrigeri 2005-08-09 20:59:20 +00:00
parent 540f7e0f7c
commit ddaceb7dda
3 changed files with 106 additions and 15 deletions

View File

@ -1,10 +1,10 @@
version XX -- ...
added pgsql (PostgreSQL) handler, with vservers support
added pgsql (PostgreSQL) handler, with vservers support.
added vservers support to duplicity handler
Note: the configuration is a bit different of rdiff
handler's one, but the default behavior is the same: have
a look to example.dup.
handler's one, but the default behavior is the same:
have a look to example.dup.
improved README
documented .disabled method.
corrected VROOTDIR default value.
@ -26,6 +26,7 @@ version XX -- ...
must not be group or world writable!" error msg).
xedit action now tries $EDITOR, then /etc/alternatives/editor,
then nano, vim and vi, and aborts if none of these exists.
added helper for pgsql handler.
version 0.7 -- July 26 2005
added ninjahelper: a dialog based wizard for creating backupninja configs.

View File

@ -1,19 +1,20 @@
### backupninja PostgreSQL config file ###
# backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups
#
# databases = < all | db1 db2 db3 > (default = all)
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
# Note: when using 'all', pg_dumpall is used instead of pg_dump, which means
# that cluster-wide data (such as users and groups) are saved.
#
# compress = < yes | no > (default = yes)
# if yes, compress the pg_dump output.
#
# vsname = <vserver> (no default)
# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
# if you do not specify a vsname the host will be operated on
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
# backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups
# databases = < all | db1 db2 db3 > (default = all)
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
# Note: when using 'all', pg_dumpall is used instead of pg_dump, which means
# that cluster-wide data (such as users and groups) are saved.
# compress = < yes | no > (default = yes)
# if yes, compress the pg_dump/pg_dumpall output.

89
handlers/pgsql.helper Normal file
View File

@ -0,0 +1,89 @@
HELPERS="$HELPERS pgsql:postgresql_database_backup"
do_pgsql_vserver() {
inputBox "$pgsql_title" "Specify a vserver name:"
[ $? = 1 ] && return;
pgsql_vsname="vsname = $REPLY"
}
do_pgsql_databases() {
formBegin "$pgsql_title: databases"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formItem "Database:"
formDisplay
[ $? = 1 ] && return
pgsql_databases="databases = "
for i in $REPLY; do
[ "$i" != "" ] && pgsql_databases="$pgsql_databases $i"
done
}
pgsql_wizard() {
# constants
pgsql_title="PostgreSQL action wizard"
# vserver support
booleanBox "$pgsql_title" "Do you want to operate on a vserver? If not, the host will be operated on."
[ $? = 0 ] && do_pgsql_vserver
# backupdir
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"
[ $? = 1 ] && return
pgsql_backupdir="backupdir = $REPLY"
# databases
booleanBox "$pgsql_title" "Do you want to backup the whole cluster? If not, you'll be offered to choose the databases to backup."
if [ $? = 0 ]; then
pgsql_databases="databases = all"
else
do_pgsql_databases
fi
# compress
booleanBox "$pgsql_title" "Do you want to compress the backups?"
if [ $? = 0 ]; then
pgsql_compress="compress = yes"
else
pgsql_compress="compress = no"
fi
# write config file
get_next_filename $configdirectory/20.pgsql
cat >> $next_filename <<EOF
### backupninja PostgreSQL config file ###
# vsname = <vserver> (no default)
# what vserver to operate on, only used if vserver = yes in /etc/backupninja.conf
# if you do not specify a vsname the host will be operated on
# Note: if operating on a vserver, $VROOTDIR will be prepended to backupdir.
$pgsql_vsname
# backupdir = <dir> (default: /var/backups/postgres)
# where to dump the backups
$pgsql_backupdir
# databases = < all | db1 db2 db3 > (default = all)
# which databases to backup. should either be the word 'all' or a
# space separated list of database names.
# Note: when using 'all', pg_dumpall is used instead of pg_dump, which means
# that cluster-wide data (such as users and groups) are saved.
$pgsql_databases
# compress = < yes | no > (default = yes)
# if yes, compress the pg_dump/pg_dumpall output.
$pgsql_compress
EOF
chmod 000 $next_filename
}