There have been multiple instances where library professionals tend to lose months or years of their work just due to the negligence of IT professionals. I myself have communicated to many of such professionals whee their entire library database was lost, in which they have placed more than 2000 man-hours, just due to sheer negligence or professional callousness. In this article, I will explain how to take automatic backup of your Koha Mysql database in a SQL file.
To remedy the problem I thought why not help these professionals so that they can maintain their own server and be independent. For this reason, I am writing this blog to help library professionals.
In this blog, I have listed down some of the steps those library professionals can use to safeguard and maintain their own work without any help. There are three things that have to be done:-
- Prepare your own koha server.
- Automatically take backup of your entire installation.
- Maintain your server on your own.
To do these in a very easy way I have prepared the ingredients on my own so that technical details can be abstracted. For this download the following from the prerequisites section:
- For installation follow the instructions given on this page https://www.gauravparashar.com/step-by-step-guide-to-install-koha-in-ubuntu-16-04/
- Open Terminal by pressing Ctrl + Alt + T.
- After installation is over then create a new file. Type the following command in terminal: $ nano script.sh
- Copy the script given below and paste it into a file. Save the script using Ctrl W and exit using Ctrl X.
- Type crontab -e on terminal.
- Type the following code inside the file.
0 8,23 * * * sh $HOME/bk.sh >> $HOME/bk.log 2>&1Save the script using Ctrl W and exit Ctrl X.
- Now your backup will be done two times daily. First at 08:00 AM and 11:00 PM.
#!/bin/bash #DATE="`date +%m`_`date +%d`_`date +%y`_`date +%H_%M_%S`.sql" DATE="Koha_$(date +%b)_$(date +%d)_$(date +%Y)_$(date +%H_%M_%S).sql" echo "Backing up the database with file name : " $DATE cd $HOME echo 'Changed drive to' $PWD echo 'Backing up the database' mysqldump --user=root --password=Type your mysql password here --default-character-set=utf8 --single-transaction --all-databases > $DATE echo 'Database backed successfully' echo 'Database Uploading completed' exit 0
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.