18/03/2019

Koha Backup | How to Setup Automatic Daily Backup in Koha 20.05

By Technical Digit

Create Shell Script for Daily Koha Backup

If you want to setup Automatic Koha Backup, Follow the below process.

Create directory for backup
> mkdir koha_backup
Allow write permission to this folder
> sudo chmod 777 koha_backup
(Exit from root directory)
Create a file
> sudo gedit koha_backup/backup.sh
Copy below text into file and save it.

#!/bin/bash
mysqldump -u[username] -p[password] koha_library | xz > koha_backup/koha_library-$(date +%d-%m-%Y-%H.%M).sql.xz

(Change [username] & [password] as per your Koha Database Credentials)

Make this file executable by following command:

> sudo chmod +x koha_backup/backup.sh
Execute the file by following command:
> sh koha_backup/backup.sh

Open Crontab:
> crontab -e
Add following line at the end of file:
45 15 * * * koha_backup/backup.sh
Save the file and close. (Backup will created at 3:45 PM Daily Automatically)

ajax loader