Vue lecture

Prepare Google Drive for Koha backup

Everybody is familiar with using Google Drive. Google Drive is the cloud storage service of Google Inc. Currently, 15 GB of free storage is available with a Google account. Koha users can make use of Google Drive storage to keep database backups. GNOME desktop facilitates synchronising online accounts like Google, Nextcloud, Facebook, Microsoft, Flickr, etc. 

Here are the steps to prepare the Koha system to store the database in Google Drive.

Installation of GNOME desktop

If the system running on desktops other than GNOME, install it. I prefer the GNOME Flashback edition for a minimal and lightweight experience. GNOME Flashback desktop can be installed on the default Ubuntu and Debian desktop. Here is the command to install GNOME Flashback on all Ubuntu variants;

sudo apt update
sudo apt install gnome-session-flashback

Command to install GNOME Flashback on Debian.

sudo apt update
sudo apt install gnome-flashback

Sign out from the current session and change the desktop to GNOME Flashback.


Prepare the system to sync Google Drive

Open the settings, Applications > System Tools > Preferences > Settings 

Select the Online accounts.

Select Google and sign in.

After the successful sign-in, the Google account is visible in the File Manager. Files and folders load into the File Manager when you click on it.




Enter inside the My Drive folder and see the files and folders. Create a folder for Koha's backup. Enter inside the folder for Koha backup and copy the folder's location. It's necessary to direct the database backup to the backup destination.

Copy the folder location and keep it in a file for later use.

The location looks like this, 
google-drive://mygmailaccount@gmail.com/0AHFZ9iUzgfcmUk9PVA/14MJDZzaMNVnosHsOj7r-Xi6bUOHn344e

Scheduling of the backup process

Here is a shell script to schedule the backup with a time stamp. It keeps three days of backup and deletes previous files to save space. Follow the instructions to schedule the backup.

Download the shell script

Copy the shell script to the home folder. Open the shell script and make changes to the Koha database, username, password and location of the backup. The timestamp of the database also appears on the backup file name. Give the number of days the backup keeps.

Move the shell script to /usr/local/bin

sudo cp backup.sh /usr/local/bin

Give the necessary permission to the shell script,

cd /usr/local/bin
sudo chmod +x backup.sh
sudo chown "$USER:$USER" backup.sh
chmod 700 backup.sh
Create the cronjob entry of the backup. Apply the following command on the terminal.

export EDITOR=mousepad
crontab -e

Copy the below lines to the bottom part of the crontab file.

#Koha backup
10 20 * * * /usr/local/bin/backup.sh

Change the timing of the backup. Here, backup takes at 8:10 PM. Watch the backed-up files appear in the folder.

  •  

pCloud for Koha backup


pCloud is a cloud storage service that offers a secure and convenient way to store, share, and access your files from anywhere. It works like Dropbox cloud storage. Dropbox gives only 2 GB of free storage only. pCloud provides a variety of pricing plans, starting with a free plan that gives you 10 GB of storage. Koha users can make use pCloud for backup storage. Schedule the backup and point to the PCloud storage is very convenient.

Installation of PCloud drive in Debian/Ubuntu.

Here are the steps on how to install PCloud software in Ubuntu:

1. Go to the pCloud website, and create an account.

2. Download the pCloud AppImage file for Linux.

3. Save the file to your computer.

4. Open a terminal window and navigate to the directory where you saved the file.

5. Run the following command to give the file executable permissions:

sudo chmod +x pcloud

Either double-click on the PCloud icon or run the following command to start the pCloud AppImage:

./pcloud

6. The pCloud login window will appear. Enter your pCloud email address and password, and click Log in.

A folder named pCloudDrive will be created in your home directory. This is your pCloud virtual drive. You can now start storing and accessing your files in pCloud.

To schedule Koha backup to pCloud please visit the following link,

http://kohageek.blogspot.com/2021/08/backup-with-auto-delete-old-files.html

The blog post gives the details of schedule backup in Dropbox cloud storage. The same steps can follow to schedule Koha backup to pCloud.

  •  

Backup with auto delete old files


Auto-deletion of old backup files helps save cloud space.

Here is a shell script to schedule the backup with a time stamp. It keeps three days of backup and deletes previous files to save space. This method is convenient for working with cloud storage with limited space (e.g. Dropbox). 
Follow the instructions below to schedule the backup.

Download the shell script

Copy the shell script to the home folder. Open the shell script and make changes to the Koha database, username, password and location of the backup. The timestamp of the database also appears on the backup file name. Give the number of days the backup keeps.

Move the shell script to /usr/local/bin

sudo cp backup.sh /usr/local/bin

Give the necessary permission to the shell script,

cd /usr/local/bin
sudo chmod +x backup.sh
sudo chown "$USER:$USER" backup.sh
sudo chmod 700 backup.sh

Create the cron job entry for the backup. Apply the following command on the terminal.

export EDITOR=mousepad
crontab -e

Copy the lines below to the bottom part of the crontab file.

#Koha backup
10 20 * * * /usr/local/bin/backup.sh

Change the timing of the backup. Here, backup takes at 8:10 PM.

  •