Added GZIP_OPTS option, defaulting to --rsyncable.

... so that this option can be disabled on systems that don't support it.
This also allows to use another compression program, such as pbzip2 on SMP
machines (closes Roundup bug #2405).
This commit is contained in:
intrigeri 2010-06-14 19:06:59 +02:00
parent 211d6506cb
commit aeca6912a8
6 changed files with 14 additions and 7 deletions

View File

@ -1,4 +1,9 @@
version 0.9.8 -- UNRELEASED version 0.9.8 -- UNRELEASED
backupninja changes
. Added GZIP_OPTS option, defaulting to --rsyncable, so that this
option can be disabled on systems that don't support it. This
also allows to use another compression program, such as pbzip2
on SMP machines (Closes Roundup bug #2405)
handler changes handler changes
sys: sys:
. Only run mdadm if RAID devices actually exist (Closes: #572450) . Only run mdadm if RAID devices actually exist (Closes: #572450)

View File

@ -86,6 +86,7 @@ vservers = no
# PGSQLDUMP=/usr/bin/pg_dump # PGSQLDUMP=/usr/bin/pg_dump
# PGSQLDUMPALL=/usr/bin/pg_dumpall # PGSQLDUMPALL=/usr/bin/pg_dumpall
# GZIP=/bin/gzip # GZIP=/bin/gzip
# GZIP_OPTS='--rsyncable'
# RSYNC=/usr/bin/rsync # RSYNC=/usr/bin/rsync
# VSERVERINFO=/usr/sbin/vserver-info # VSERVERINFO=/usr/sbin/vserver-info
# VSERVER=/usr/sbin/vserver # VSERVER=/usr/sbin/vserver

View File

@ -86,7 +86,7 @@ if [ "$ldif" == "yes" ]; then
fi fi
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="$execstr | $GZIP --rsyncable > $dumpdir/$dbsuffix.ldif.gz" execstr="$execstr | $GZIP $GZIP_OPTS > $dumpdir/$dbsuffix.ldif.gz"
else else
execstr="$execstr > $dumpdir/$dbsuffix.ldif" execstr="$execstr > $dumpdir/$dbsuffix.ldif"
fi fi

View File

@ -279,7 +279,7 @@ then
fatal "mysqld doesn't appear to be running!" fatal "mysqld doesn't appear to be running!"
fi fi
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec $DUMP | $GZIP --rsyncable > '$vroot$dumpdir/${db}.sql.gz'" execstr="$VSERVER $vsname exec $DUMP | $GZIP $GZIP_OPTS > '$vroot$dumpdir/${db}.sql.gz'"
else else
execstr="$VSERVER $vsname exec $DUMP -r '$vroot$dumpdir/${db}.sql'" execstr="$VSERVER $vsname exec $DUMP -r '$vroot$dumpdir/${db}.sql'"
fi fi
@ -290,7 +290,7 @@ then
fatal "mysqld doesn't appear to be running!" fatal "mysqld doesn't appear to be running!"
fi fi
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="$DUMP | $GZIP --rsyncable > '$dumpdir/${db}.sql.gz'" execstr="$DUMP | $GZIP $GZIP_OPTS > '$dumpdir/${db}.sql.gz'"
else else
execstr="$DUMP -r '$dumpdir/${db}.sql'" execstr="$DUMP -r '$dumpdir/${db}.sql'"
fi fi

View File

@ -75,13 +75,13 @@ chmod 700 $vroot$backupdir
if [ "$databases" == "all" ]; then if [ "$databases" == "all" ]; then
if [ $usevserver = yes ]; then if [ $usevserver = yes ]; then
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${vsname}.sql.gz'\"" execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\""
else else
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\"" execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\""
fi fi
else else
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${localhost}-all.sql.gz'\"" execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\""
else else
execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\""
fi fi
@ -104,13 +104,13 @@ else
for db in $databases; do for db in $databases; do
if [ $usevserver = yes ]; then if [ $usevserver = yes ]; then
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\"" execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\""
else else
execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\"" execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\""
fi fi
else else
if [ "$compress" == "yes" ]; then if [ "$compress" == "yes" ]; then
execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\"" execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\""
else else
execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\"" execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\""
fi fi

View File

@ -480,6 +480,7 @@ getconf PGSQLDUMP /usr/bin/pg_dump
getconf PGSQLDUMPALL /usr/bin/pg_dumpall getconf PGSQLDUMPALL /usr/bin/pg_dumpall
getconf PGSQLUSER postgres getconf PGSQLUSER postgres
getconf GZIP /bin/gzip getconf GZIP /bin/gzip
getconf GZIP_OPTS --rsyncable
getconf RSYNC /usr/bin/rsync getconf RSYNC /usr/bin/rsync
getconf admingroup root getconf admingroup root