@@ -, +, @@
exclude logs
---
debian/scripts/koha-dump | 24 +++++++++++++++++++++---
debian/scripts/koha-run-backups | 13 +++++++------
2 files changed, 28 insertions(+), 9 deletions(-)
--- a/debian/scripts/koha-dump
+++ a/debian/scripts/koha-dump
@@ -2,17 +2,17 @@
#
# koha-dump: dump all contents and configs for a Koha site
# Copyright 2010 Catalyst IT, Ltd
-#
+#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
@@ -48,6 +48,7 @@ $scriptname -h|--help
--schema-only Dump only the database schema
--exclude-indexes Include Zebra indexes on the backup
+ --exclude-logs Exclude /var/log/koha/name from the backup
--uploaded_files Include uploaded files.
--uploaded_temp_files Include temporary uploaded files.
--quiet|-q Make the script avoid printing to STDOUT
@@ -123,6 +124,18 @@ dump_instance()
output="$output to $metadump"
[ "$quiet" = "no" ] && echo "$output"
+ if [ "$exclude_logs" = "yes" ]; then
+ tar -czf "$metadump" -C / $excludes \
+ "etc/koha/sites/$name" \
+ "etc/apache2/sites-available/$instancefile" \
+ "etc/apache2/sites-enabled/$instancefile" \
+ "var/lib/koha/$name" \
+ $uploaded_files_dir \
+ $uploaded_temp_files_dir
+
+ chown "root:$name-koha" "$metadump"
+ chmod g+r "$metadump"
+ else
tar -czf "$metadump" -C / $excludes \
"etc/koha/sites/$name" \
"etc/apache2/sites-available/$instancefile" \
@@ -134,6 +147,7 @@ dump_instance()
chown "root:$name-koha" "$metadump"
chmod g+r "$metadump"
+ fi
[ "$quiet" = "no" ] && echo "Done."
fi
@@ -144,6 +158,7 @@ quiet="no"
exclude_indexes="no"
without_db_name="no"
schema_only="no"
+exclude_logs="no"
while [ $# -gt 0 ]; do
@@ -154,6 +169,9 @@ while [ $# -gt 0 ]; do
--exclude-indexes)
exclude_indexes="yes"
shift ;;
+ --exclude-logs)
+ exclude_logs="yes"
+ shift ;;
--without-db-name)
without_db_name="yes"
shift ;;
--- a/debian/scripts/koha-run-backups
+++ a/debian/scripts/koha-run-backups
@@ -1,16 +1,16 @@
#!/bin/sh
# Copyright 2010-2011 Catalyst IT, Ltd
-#
+#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
@@ -40,7 +40,7 @@ EOH
exclude_indexes=""
-CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes -n 'koha-run-backups' -- "$@"`
+CMD_LINE=`getopt -o h --long days:,output:,help,exclude-indexes,exclude-logs -n 'koha-run-backups' -- "$@"`
if [ $? != 0 ] ; then show_help ; exit 1 ; fi
@@ -55,6 +55,8 @@ while true ; do
dirname=$2; shift 2 ;;
--exclude-indexes)
exclude_indexes='--exclude-indexes'; shift ;;
+ --exclude-logs)
+ exclude_logs='--exclude-logs'; shift ;;
--) shift ; break ;;
*) echo "Unknown error parsing the command line!" ; exit 1 ;;
esac
@@ -67,7 +69,7 @@ fi
for name in $(koha-list --enabled | grep -Fxv demo)
do
- if koha-dump ${exclude_indexes} "$name" > /dev/null; then
+ if /kohadevbox/koha/debian/scripts/koha-dump ${exclude_indexes} ${exclude_logs} "$name" > /dev/null; then
# Only delete old backups if dump script return success.
if [ -z "$dirname" ]; then
@@ -79,4 +81,3 @@ do
find $backupdir -maxdepth 1 \( -mtime +$days -or -mtime $days \) -name $name-'[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].???'.gz \( -name \*.sql.gz -or -name \*.tar.gz \) -print0 | xargs -0 -r rm
fi
done
-
--