Koha Backup | How to Setup Automatic Backup in Koha

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.

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 lines at the end of file:

45 15 * * * koha_backup/backup.sh
00 16 * * * find koha_backup/* -mtime +180 -exec rm {} \;
Save the file and close. (Backup will created at 3:45 PM Daily Automatically)

Total Views: 2157