Bug 14264: Fix export of late orders when translated
[koha.git] / misc / cronjobs / backup.sh
blob17150a9b7e55640364752ae7af01ce8072ee1d66
1 #!/bin/sh
2 # Script to create daily backups of the Koha database.
3 # Based on a script by John Pennington
5 DATABASE=`xmlstarlet sel -t -v 'yazgfs/config/database' $KOHA_CONF`
6 HOSTNAME=`xmlstarlet sel -t -v 'yazgfs/config/hostname' $KOHA_CONF`
7 PORT=`xmlstarlet sel -t -v 'yazgfs/config/port' $KOHA_CONF`
8 USER=`xmlstarlet sel -t -v 'yazgfs/config/user' $KOHA_CONF`
9 PASS=`xmlstarlet sel -t -v 'yazgfs/config/pass' $KOHA_CONF`
10 BACKUPDIR=`xmlstarlet sel -t -v 'yazgfs/config/backupdir' $KOHA_CONF`
11 KOHA_DATE=`date '+%Y%m%d'`
12 KOHA_BACKUP=$BACKUPDIR/koha-$KOHA_DATE.sql.gz
14 mysqldump --single-transaction --user=$USER --password="$PASS" --port=$PORT --host=$HOST $DATABASE| gzip -9 > $KOHA_BACKUP
16 if [ -f $KOHA_BACKUP ] ; then
17 echo "$KOHA_BACKUP was successfully created." | mail $USER -s $KOHA_BACKUP
18 else
19 echo "$KOHA_BACKUP was NOT successfully created." | mail $USER -s $KOHA_BACKUP
22 # Notifies kohaadmin of (un)successful backup creation
23 # EOF