Skip to main content

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

  1. Configure transfers.tsv with your routes
  2. Generate cron files: lz-generate-cron
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

landingzones-1.0.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

landingzones-1.0.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

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

Hashes for landingzones-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4f580f9910dead6b4bee3e24039fc909d4f0f26813c7c66b6b935a1a5b4a2a2c
MD5 8d502184fa01d5421de463b193b7dcc0
BLAKE2b-256 ecff6eb725a50653c0c56169efe3f53f8c6dd17e5533629b5d8634d15211c6a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for landingzones-1.0.0.tar.gz:

Publisher: publish.yml on ssi-dk/landingzones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for landingzones-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 539b2164fafa19bb0ede551c066ee5c5497acd38b218e2bda3445d42012f2b82
MD5 142e67502a4da6a7ff2b50941ea50d91
BLAKE2b-256 0b5836bd28cbce6acb3b8aa272d5a9ad9eeb467166fc350d9ab57af95ded0708

See more details on using hashes here.

Provenance

The following attestation bundles were made for landingzones-1.0.0-py3-none-any.whl:

Publisher: publish.yml on ssi-dk/landingzones

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page