Automated data transfer system using rsync and cron
Project description
Landing Zones
Automated data transfer system using rsync with cron job generation.
Quick Start
# Install
pip install -e .
# Generate cron files
lz-generate-cron --help
lz-generate-cron --transfers config/transfers.tsv --output-dir output/crontab.d --log-dir log
# Check deployment readiness
lz-check-deployment
Project Structure
landingzones/
├── src/landingzones/ # Main package
│ ├── generate_cron_files.py # Cron generation tool
│ ├── check_deployment_readiness.py
│ └── config/transfers.tsv # Default config
├── input/ # Default input directory
├── output/ # Default output directory
│ └── crontab.d/ # Generated cron files
├── log/ # Default log directory
├── tests/ # Test suite
├── setup.py # Package config
└── requirements.txt # Dependencies
Configuration
The system is configured via a tab-separated transfers.tsv file:
| Column | Description | Example |
|---|---|---|
system |
Source system identifier | server1, localhost |
users |
System user for transfer | user1, local |
source |
Source directory path | /srv/data/src/ |
destination |
Destination (local or remote) | user@host:/dest/ |
destination_port |
SSH port (optional) | 225 |
rsync_options |
Additional rsync flags | --chown=:group |
log_file |
Log file path (optional) | log/transfers.log |
flock_file |
Lock file path | /tmp/transfer.lock |
Example
system users source destination destination_port rsync_options log_file flock_file
localhost testuser input/* output/ log/transfers.log /tmp/landingzones.lock
CLI Commands
# Generate cron files with defaults
lz-generate-cron
# Custom paths
lz-generate-cron -t config/transfers.tsv -o output/crontab.d -l log
# Check deployment
lz-check-deployment
Generated Cron Format
*/15 * * * * /usr/bin/flock -n /tmp/landingzones.lock -c '\
rsync -av --remove-source-files /source/ /dest/ >> log/transfers.log 2>&1 && \
find /source/ -mindepth 1 -type d -empty -delete >> log/transfers.log 2>&1'
Installation
# Development mode
pip install -e .
# With test dependencies
pip install -e ".[test]"
# Production
pip install .
Testing
# Run all tests
pytest
# Verbose
pytest -v
# With coverage
pytest --cov=landingzones --cov-report=html
# Specific test
pytest tests/test_generate_cron_files.py::TestClassName::test_method
Deployment
- Configure
transfers.tsvwith your routes - Generate cron files:
lz-generate-cron - Deploy:
cp output/crontab.d/*.cron ~/crontab.d/ cat ~/crontab.d/*.cron | crontab -
Or use automated deployment:
lz-check-deployment
Development
# Make changes in src/landingzones/
# Run tests
pytest
# Test CLI
lz-generate-cron --help
Requirements
- Python >= 3.8
- pandas >= 1.0.0
- System: rsync, ssh, flock
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
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 landingzones-1.0.0.tar.gz.
File metadata
- Download URL: landingzones-1.0.0.tar.gz
- Upload date:
- Size: 20.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f580f9910dead6b4bee3e24039fc909d4f0f26813c7c66b6b935a1a5b4a2a2c
|
|
| MD5 |
8d502184fa01d5421de463b193b7dcc0
|
|
| BLAKE2b-256 |
ecff6eb725a50653c0c56169efe3f53f8c6dd17e5533629b5d8634d15211c6a6
|
Provenance
The following attestation bundles were made for landingzones-1.0.0.tar.gz:
Publisher:
publish.yml on ssi-dk/landingzones
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
landingzones-1.0.0.tar.gz -
Subject digest:
4f580f9910dead6b4bee3e24039fc909d4f0f26813c7c66b6b935a1a5b4a2a2c - Sigstore transparency entry: 738067991
- Sigstore integration time:
-
Permalink:
ssi-dk/landingzones@d77c625dae71e70ca169dd217eb1bcbbe45aee2e -
Branch / Tag:
refs/tags/v0.1.0-alpha - Owner: https://github.com/ssi-dk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d77c625dae71e70ca169dd217eb1bcbbe45aee2e -
Trigger Event:
push
-
Statement type:
File details
Details for the file landingzones-1.0.0-py3-none-any.whl.
File metadata
- Download URL: landingzones-1.0.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
539b2164fafa19bb0ede551c066ee5c5497acd38b218e2bda3445d42012f2b82
|
|
| MD5 |
142e67502a4da6a7ff2b50941ea50d91
|
|
| BLAKE2b-256 |
0b5836bd28cbce6acb3b8aa272d5a9ad9eeb467166fc350d9ab57af95ded0708
|
Provenance
The following attestation bundles were made for landingzones-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on ssi-dk/landingzones
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
landingzones-1.0.0-py3-none-any.whl -
Subject digest:
539b2164fafa19bb0ede551c066ee5c5497acd38b218e2bda3445d42012f2b82 - Sigstore transparency entry: 738067995
- Sigstore integration time:
-
Permalink:
ssi-dk/landingzones@d77c625dae71e70ca169dd217eb1bcbbe45aee2e -
Branch / Tag:
refs/tags/v0.1.0-alpha - Owner: https://github.com/ssi-dk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d77c625dae71e70ca169dd217eb1bcbbe45aee2e -
Trigger Event:
push
-
Statement type: