A Python script for backing up and synchronizing data between SSD and HDD with CPU usage monitoring.
Project description
Setup dev environment
python3 -m pip install -r requirements.txt
pre-commit install
Run application
-
Backup
python3 -c "\ from auto_backup_storage import process_pair_in_pool;\ source_destination_pairs = [\ ('/mnt/C67881AE78819DB5/PIXAR/Vizgard/', '/mnt/90848C74848C5F1A/Vizgard/',),\ ('/mnt/C67881AE78819DB5/DISNEY/', '/mnt/404A81F44A81E74E/DISNEY/',),\ ('/mnt/C67881AE78819DB5/Downloads-Windows/', '/mnt/404A81F44A81E74E/Downloads-Windows/',),\ ('/mnt/00AE2C6B5AC8D335/', '/mnt/404A81F44A81E74E/365GB-SSD/',),\ ('/mnt/C67881AE78819DB5/PIXAR/', '/mnt/404A81F44A81E74E/PIXAR/',),\ ('/home/emoi/Downloads/', '/mnt/404A81F44A81E74E/Downloads-Ubuntu/',),\ ('/mnt/90848C74848C5F1A/4k/', '/mnt/404A81F44A81E74E/1TB-HDD/4K-videos',),\ ('/mnt/90848C74848C5F1A/8k/', '/mnt/404A81F44A81E74E/1TB-HDD/8K-videos',),\ ];\ process_pair_in_pool(source_destination_pairs);"
python3 -c "\
from auto_backup_storage import process_pair_in_pool;\
source_destination_pairs = [\
('/home/emoi/Downloads/Boost.Asio.Cpp.Network.Programming.Cookbook/', '/mnt/404A81F44A81E74E/Boost.Asio.Cpp.Network.Programming.Cookbook/',),\
];\
process_pair_in_pool(source_destination_pairs);"
-
Restore
- reverse source path, destination path
Build package
python3 setup.py sdist bdist_wheel
Publish package to Pypi
twine upload dist/*
Setup daemon
sudo nano /etc/systemd/system/auto-backup-storage.service
[Unit]
Description=Daemon for serving auto-backup-storage
After=network.target
[Service]
User=1000
Group=1000
ExecStart=/bin/bash -c "\
/home/emoi/anaconda3/bin/python3 -m pip install --upgrade auto-backup-storage && \
/home/emoi/anaconda3/bin/python3 -c 'from auto_backup_storage import process_pair_in_pool; source_destination_pairs = [\
(\"/mnt/C67881AE78819DB5/PIXAR/Vizgard/\", \"/mnt/90848C74848C5F1A/Vizgard/\"),\
(\"/mnt/C67881AE78819DB5/DISNEY/\", \"/mnt/404A81F44A81E74E/DISNEY/\"),\
(\"/mnt/C67881AE78819DB5/Downloads-Windows/\", \"/mnt/404A81F44A81E74E/Downloads-Windows/\"),\
(\"/mnt/00AE2C6B5AC8D335/\", \"/mnt/404A81F44A81E74E/365GB-SSD/\"),\
(\"/mnt/C67881AE78819DB5/PIXAR/\", \"/mnt/404A81F44A81E74E/PIXAR/\"),\
(\"/home/emoi/Downloads/\", \"/mnt/404A81F44A81E74E/Downloads-Ubuntu/\"),\
(\"/mnt/90848C74848C5F1A/4k/\", \"/mnt/404A81F44A81E74E/1TB-HDD/4K-videos\"),\
(\"/mnt/90848C74848C5F1A/8k/\", \"/mnt/404A81F44A81E74E/1TB-HDD/8K-videos\")]; \
process_pair_in_pool(source_destination_pairs);'"
ExecReload=/usr/bin/kill -s HUP $MAINPID
Restart=always
# RestartSec=60
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl status auto-backup-storage.service
sudo journalctl -u auto-backup-storage.service
sudo systemctl start auto-backup-storage.service
sudo systemctl restart auto-backup-storage.service
sudo systemctl stop auto-backup-storage.service
sudo systemctl enable auto-backup-storage.service
sudo systemctl is-enabled auto-backup-storage.service
sudo systemctl disable auto-backup-storage.service
Executable file
From v0.1.6 I can backup with executable file
auto_backup_storage /path/to/source /path/to/destination
Docker environment
docker run -it --rm -v $(pwd):/workspace/auto_backup_storage python:3.12.7-alpine /bin/sh
apk update
cd /workspace/auto_backup_storage
python3 -m pip install setuptools
python3 setup.py sdist bdist_wheel
apk add twine
apk add gcc python3-dev musl-dev linux-headers
TWINE_USERNAME="__token__" TWINE_PASSWORD="pypi-....................................................." twine upload --non-interactive dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
auto_backup_storage-1.1.1.tar.gz
(12.5 kB
view details)
Built Distribution
File details
Details for the file auto_backup_storage-1.1.1.tar.gz
.
File metadata
- Download URL: auto_backup_storage-1.1.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
56b7d380e9ed5f7d7f228c3958673be72a5461a65d9956eaa6cfc67200149faf
|
|
MD5 |
66628aa2471752bd449697fa915e5040
|
|
BLAKE2b-256 |
3bb0365154ea384cbac9b0d75a9161e044653012737e8f44df2f8d438a127b1f
|
File details
Details for the file auto_backup_storage-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: auto_backup_storage-1.1.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
0befc1c4c8f72cb86bdd1d4a1d2a556ceee829aab77511f4a2da938d999977f0
|
|
MD5 |
54bded4150896ba46965fe831cb378b2
|
|
BLAKE2b-256 |
5981b5159f1a101eaf2ff80c3eed1d5133a1585258694470606492257b2c86ab
|