school-form-db-backuper

Creates periodic logs of the school-form database in case a change is produced, and uploads them to a Dropbox folder.

Designed as a helper to backup the results from: https://github.com/Marcos-A/school-form.


Requirements:

  1. Install:
sudo apt-get install python3	
sudo apt install python3-pip
pip3 install dropbox
pip3 install psycopg2-binary
  1. Set up your "database.ini" file and place it in the project's root folder:
[postgresql]
host=YOUR-HOST
database=YOUR-DATABASE
user=YOUR-USER
password=YOUR-PASSWORD
port=YOUR-PORT
options=-c search_path=dbo,YOUR-SCHEMA
  1. Get your Dropbox API v2 token from https://www.dropbox.com/developers/documentation/http/overview. Make sure it grants 'files.metadata.read', 'files.metadata.write', 'files.content.read' and 'files.content.write' permissions. Set up your "dropbox.ini" file and place it in the project's root folder:
[dropbox]
token=YOUR-DROPBOX-API-V2-TOKEN
  1. The script will look for changes every 900 seconds (15 minutes). Change this period of time according to your needs replacing this amount at the "school_form_backuper.py" file (line 133, "sleep" function).

How to run

From within the project's root folder, run: python3 school_form_backuper.py. The script will run until the process is interrupted.

To execute the script in the background, from within the project's root folder run: python3 school_form_backuper.py &. Get your process PID with: jobs -l. Interrupt the process with: kill YOUR-PROCESS-PID.