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.4.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.4-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: landingzones-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 059a2434a83cd5c7156d11545fed591fef6c39943590278159731574e748320e
MD5 af6587afc8c3800341e57f9fcb65411c
BLAKE2b-256 93996bc3e2ae997cbaad99818cd32b54a3dc8e14f19bda913179c4a608926d4c

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: landingzones-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 09576fe76e2ce4321aafb89ae9752d925ae4cdb0327668fe0d2b17bc482ec6da
MD5 80653a1a73a0341c1af2ad0fd3f9151a
BLAKE2b-256 6495aec90b401ff54a8e678fa8f84e88130d58d3dfb72c6b110c5a4e54d460f3

See more details on using hashes here.

Provenance

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