Synchronize and store Koha backup in Dropbox

Drobox is an online storage service and it offers 2 GB free storage space. "Dropbox allows users to create a special folder on their computers, which Dropbox then synchronizes so that it appears to be the same folder (with the same contents) regardless of which device is used to view it. Files placed in this folder are also accessible via the Dropbox website and mobile apps". It is very convenient to store Koha database backup in Dropbox cloud storage. No need to copy Koha data base in pen drive everyday.

Install Dropbox client
Create Dropbox account.
Ubuntu users can install the package using the command;

sudo apt-get install nautilus-dropbox

After the installation of the package, open the client from
Applications > Internet > Dropbox
Let it finish the installation.

Sign in the Dropbox account after finishing the installation.


Dropbox will create a folder "Dropbox" in Linux user home. Where we have to point Koha backup destination. Files deposited in Dropbox folder also save in cloud storage.

Automatic Koha backup
Here we are going to schedule Koha backup in every 60 minutes the help of cronjob

Open Applications > Accessories > Terminal

 Apply the following command,

crontab -e

It will ask to select a text editor. You can select Nano text editor.

Use down arrow button and move the cursor to the bottom part of the cron file. Copy following command there.

*/60 * * * * mysqldump -uroot -pmysqlroot koha_library | xz > /home/koha/Dropbox/koha_library.sql.xz

Backup on a specific time
If the library close at 5 PM. You can schedule backup on 4:45 PM.

45 16 * * * mysqldump -uroot -pmysqlroot koha_library | xz > /home/koha/Dropbox/koha_library.sql.xz

Change MySQL password and the destination folder location.

Apply  Ctrl + o button to save the file.

Then apply Ctrl + x to leave the cron.

You can find the backup file in /home/koha/Dropbox folder after 60 minutes.

After 60 minutes login to dropbox.com to check backup moved to online storage.

Explanations of key parts in the command,

*/60 = Every 60 minute take a backup.User can change the frequency.
-uroot = MySQL root user name

-pmysqlroot = password of MySQL root user.

koha_library = Koha database name

Reference
https://help.ubuntu.com/community/CronHowto#Crontab_Example

7 comments:

  1. Sir, We can use this command for Dropbox install: sudo apt-get install nautilus-dropbox.

    ReplyDelete
    Replies
    1. Thank you very much.
      With single command Dropbox can isntall.

      Delete
    2. Sir,
      you can encrypt database before uploading to Dropbox. I think Google Drive(15GB) is a better option than Dropbox. We did it. You are maintaining a good blog.
      --------------manuraj723@gmail.com------------------

      Delete
  2. Thank you Ji..
    I shall try to install dropbox for backup.
    Thanks a lot.

    ReplyDelete
  3. Sir,
    How can we create a mail facility in KOHA other than predefined mails. For eg: Acknowledgement for paid fines..................................
    m@nur@j

    ReplyDelete
  4. How to install Dropbox with Ubuntu Server without GUI?

    ReplyDelete
    Replies
    1. Please check,
      https://help.ubuntu.com/community/Dropbox
      https://www.digitalocean.com/community/tutorials/how-to-install-dropbox-client-as-a-service-on-ubuntu-14-04

      Delete