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.1.tar.gz (20.8 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.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file landingzones-1.0.1.tar.gz.

File metadata

  • Download URL: landingzones-1.0.1.tar.gz
  • Upload date:
  • Size: 20.8 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.1.tar.gz
Algorithm Hash digest
SHA256 49b580b6ba0001a5ca34efcd0c1fcd394dcea68dcbf235ecd48da15889cd6e79
MD5 aaf713ff8412f8c3d19bca74c11a9343
BLAKE2b-256 93a095330168bd288b5d6b1cb602b25ef9dd9bceb66c2f272bd742f8ff83f18b

See more details on using hashes here.

Provenance

The following attestation bundles were made for landingzones-1.0.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: landingzones-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 859b54c242a78019134955f97c2327d7b6586957b6a37cc575154fdecb732190
MD5 25359122d22f753322129a6798fb7c36
BLAKE2b-256 756ccfcc07b1730a32689d7548779c4d7ce601d866b3666a7d5bbe1b072cae3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for landingzones-1.0.1-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