Bugzilla – Attachment 4129 Details for
Bug 6275
Automated backups of data and config
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Signed off patch
0001-Bug-6275-allow-automated-backups-for-packages.patch (text/plain), 4.84 KB, created by
Chris Cormack
on 2011-05-16 22:02:43 UTC
(
hide
)
Description:
Signed off patch
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2011-05-16 22:02:43 UTC
Size:
4.84 KB
patch
obsolete
>From 13458c0e11ca7364712b240defd3b9535b598b35 Mon Sep 17 00:00:00 2001 >From: Robin Sheat <robin@catalyst.net.nz> >Date: Thu, 28 Apr 2011 15:21:04 +1200 >Subject: [PATCH] Bug 6275 - allow automated backups for packages > >This causes backups for the last two days to be stored by default. The >backups will go into /var/spool/koha. > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > debian/koha-common.cron.daily | 1 + > debian/koha-common.install | 1 + > debian/scripts/koha-run-backups | 93 +++++++++++++++++++++++++++++++++++++++ > 3 files changed, 95 insertions(+), 0 deletions(-) > create mode 100755 debian/scripts/koha-run-backups > >diff --git a/debian/koha-common.cron.daily b/debian/koha-common.cron.daily >index 059682e..e2c7a80 100644 >--- a/debian/koha-common.cron.daily >+++ b/debian/koha-common.cron.daily >@@ -22,3 +22,4 @@ koha-foreach --enabled /usr/share/koha/bin/cronjobs/holds/cancel_expired_holds.p > koha-foreach --enabled /usr/share/koha/bin/cronjobs/services_throttle.pl > /dev/null 2>&1 > koha-foreach --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --sessions --zebraqueue 10 > koha-foreach --enabled --noemail /usr/share/koha/bin/cronjobs/cleanup_database.pl --mail >+koha-run-backups --days 2 --output /var/spool/koha >diff --git a/debian/koha-common.install b/debian/koha-common.install >index 6ed2587..5f4bef4 100644 >--- a/debian/koha-common.install >+++ b/debian/koha-common.install >@@ -22,6 +22,7 @@ debian/scripts/koha-remove usr/sbin > debian/scripts/koha-reset-passwd usr/sbin > debian/scripts/koha-restart-zebra usr/sbin > debian/scripts/koha-restore usr/sbin >+debian/scripts/koha-run-backups usr/sbin > debian/scripts/koha-start-zebra usr/sbin > debian/scripts/koha-stop-zebra usr/sbin > debian/scripts/koha-upgrade-schema usr/sbin >diff --git a/debian/scripts/koha-run-backups b/debian/scripts/koha-run-backups >new file mode 100755 >index 0000000..7bf39c5 >--- /dev/null >+++ b/debian/scripts/koha-run-backups >@@ -0,0 +1,93 @@ >+#!/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 <http://www.gnu.org/licenses/>. >+ >+# Daily cron job for koha. >+# - dump all sites, except one called 'demo' >+ >+dirname="/var/spool/koha" >+days="2" >+ >+show_help() { >+ cat <<EOH >+$0 - performs backups of the koha installations on the system >+ >+This allows automation of backing up the koha data and configuration to the >+filesystem. It will keep the past so many backups, discarding older ones. >+ >+Options: >+ --output: the directory that the resulting files will be placed into. >+ (default: /var/spool/koha) >+ --days: the number of days to keep backups around for >+ (default: 2) >+ >+Note: backups produced using this tool can be restored using \`koha-restore'. >+EOH >+} >+ >+CMD_LINE=`getopt -o h --long days:,output:,help -n 'koha-run-backups' -- "$@"` >+ >+if [ $? != 0 ] ; then show_help ; exit 1 ; fi >+ >+eval set -- "$CMD_LINE" >+while true ; do >+ case "$1" in >+ -h|--help) >+ show_help; exit;; >+ --days) >+ days=$2; shift 2 ;; >+ --output) >+ dirname=$2; shift 2 ;; >+ --) shift ; break ;; >+ *) echo "Unknown error parsing the command line!" ; exit 1 ;; >+ esac >+done >+ >+for name in $(koha-list --enabled | grep -Fxv demo) >+do >+ koha-dump "$name" > /dev/null >+ >+ # Remove old dump files. >+ # FIXME: This could probably be replaced by one line of perl. >+ ls "$dirname/$name/" | >+ sed "s:^$name-\([0-9-]*\)\.\(sql\|tar\)\.gz$:\1:" | >+ sort -u | >+ tac | >+ sed "1,${days}d" | >+ tac | >+ while read date >+ do >+ tardump="$dirname/$name/$name-$date.tar.gz" >+ sqldump="$dirname/$name/$name-$date.sql.gz" >+ if [ -e "$tardump" ] && [ -e "$sqldump" ] >+ then >+ rm "$tardump" >+ rm "$sqldump" >+ elif [ -e "$tardump" ] || [ -e "$sqldump" ] >+ then >+ echo "Only one of a pair exists! Not removing it." >+ for x in "$tardump" "$sqldump" >+ do >+ if [ -e "$x" ] >+ then >+ echo "Exists : $x" >+ else >+ echo "Does not exist: $x" >+ fi >+ done >+ fi >+ done >+done >+ >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6275
:
4013
| 4129