Python GUI tool to generate NAS sync bash scripts
Project description
nas-sync-script-builder
Python GUI tool to generate a bash script for one-way, no-deletion NAS sync using rsync and lsyncd.
The script is idempotent and safe to re-run.
The script sets up a one way sync with no deletions, not a mirror.
Features:
- Automatic detection of eligible local partitions via UDisks2 (D-Bus)
- One-way sync only (local → NAS)
- No deletions on destination
- Initial sync using rsync --update
- Real-time sync via lsyncd
- Safe mount handling with systemd automounts
- Persistent credentials handling
- Configurable exclude patterns
Requirements
System (Linux)
- systemd
- udisks2
- CIFS/SMB-compatible NAS (e.g. Synology)
The generated script installs these automatically:
- lsyncd
- cifs-utils
Python Environment
It is strongly recommended to use a virtual environment.
python3 -m venv venv
source venv/bin/activate
Install Python dependencies:
pip install PySide6 Jinja2 PyYAML pydbus
System Dependencies for D-Bus (pydbus / PyGObject)
Required by PyGObject:
sudo apt install libgirepository-2.0-dev libcairo2-dev pkg-config
Required by pydbus:
pip install PyGObject
Editable install:
pip install -e .
Install the build tools:
pip install build twine
Create the distribution files:
python -m build
Running the GUI
python3 nas_sync_script_builder.py
This opens the GUI where you can:
- Review detected partitions
- Edit filesystem types if needed
- Configure NAS connection details
- Customize exclude patterns
- Adjust local → NAS directory mappings
Click Generate to:
- Save settings to
nas_sync_config.yaml - Generate the bash script
nas-sync.sh
Running the Generated Script
sudo ./nas-sync.sh
The script will:
- Install required system packages
- Prompt once for the NAS password and create
/etc/samba/credentials - Create mount points for local disks and NAS shares
- Configure mounts in
/etc/fstab - Perform an initial sync
- Configure lsyncd in
/etc/lsyncd/lsyncd.conf.lua - Configure lsyncd systemd dependencies in
/etc/systemd/system/lsyncd.service.d/override.conf - Configure lsyncd log rotation in
/etc/logrotate.d/lsyncd - Increase inotify max_user_watches in
/etc/sysctl.d/99-inotify.conf - Enable and start lsyncd
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nas_sync_script_builder-0.1.0.tar.gz.
File metadata
- Download URL: nas_sync_script_builder-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c7cb1fcaef2b5b27f4e073e07049ba0a2c8bb0a7feb5c1fbd26851082cff80e
|
|
| MD5 |
bbacb39e6b8740924d94a60ee0678595
|
|
| BLAKE2b-256 |
54b13e764d06e730a4f996ed6a0d62e8bb8199b679c17dca72f461465c5a34fb
|
File details
Details for the file nas_sync_script_builder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nas_sync_script_builder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78d0230c514abbfc7f8eeb002c23815a0ade24ae27632eef31facad11cd8ee06
|
|
| MD5 |
c6d230675e9fa7af3d7c4943eb58a3a2
|
|
| BLAKE2b-256 |
3af499f5815bee8f8fa4e0854e917305e8ae368a5c64a10cff9af312f4948999
|