This program is used to backup your server's data like uploaded images by using rsync.
Install the project with python
git clone https://github.com/devnla/server-backup.git
cd server-backup
cp .env.example .env
pip install -r requirements.txt
Run the program to make a backup
python server-backup.py backup
Run the program to display logs
python server-backup.py log {number of logs}
Run the project in cron job daily
0 0 * * * /usr/bin/python3 /path/to/server-backup.py backup
To run this project, you will need to add the following environment variables to your .env file
SERVER
- IP or Host of the server
PORT
- Port of the server
SSH_TYPE
- password or private key
SSH_USER
- username of the server
SSH_PASS
- password of the server
SSH_KEY_PATH
- path of the private key
REMOTE_DIR
- directory on the remote server
LOCAL_DIR
- directory on the local machine
LOG_FILE
- path of the log file