From 8e6b93acd7ee4adf3a509a85afd61defb973d484 Mon Sep 17 00:00:00 2001 From: rangi Date: Tue, 11 Jun 2002 22:03:44 +0000 Subject: [PATCH] The script mike uses to run backups on the koha database --- misc/backup.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 misc/backup.sh diff --git a/misc/backup.sh b/misc/backup.sh new file mode 100644 index 0000000000..940a9a0b6b --- /dev/null +++ b/misc/backup.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Script to create daily backups of the Koha database. +# Based on a script by John Pennington +KOHA_DATE=`date '+%y%m%d'` +KOHA_DUMP=/tmp/koha-$KOHA_DATE.dump +KOHA_BACKUP=/tmp/koha-$KOHA_DATE.dump.gz + +mysqldump -u koha -ppassword koha > $KOHA_DUMP && +gzip -f $KOHA_DUMP && +# Creates the dump file and compresses it; +# -u is the Koha user, -p is the password for that user. +# The -f switch on gzip forces it to overwrite the file if one exists. + +mv $KOHA_BACKUP /home/kohaadmin && +chown kohaadmin.users /home/kohaadmin/koha-$KOHA_DATE.dump.gz && +chmod 600 /home/kohaadmin/koha-$KOHA_DATE.dump.gz && +# Makes the compressed dump file property of the kohaadmin user. +# Make sure that you replace kohaadmin with a real user. + +echo "$KOHA_BACKUP was successfully created." | mail kohaadmin -s $KOHA_BACKUP || +echo "$KOHA_BACKUP was NOT successfully created." | mail kohaadmin -s $KOHA_BACKUP +# Notifies kohaadmin of (un)successful backup creation +# EOF \ No newline at end of file -- 2.39.5