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

Uploaded Python 3

File details

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

File metadata

  • Download URL: landingzones-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 d60832cf713bae25bdf5f5dbba0df323f9d948b58729552cd900f4eeb04f77eb
MD5 cd40cce3c10edb114c30c10b2a4e3159
BLAKE2b-256 520c46161654ad84e683516b5a2a5387881f71d0fd6e3e870390435fb4d82207

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: landingzones-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 daf259e612be8bd3a64fe63b5d6250b3edb3062e998930f7a2735a6233ee9bfe
MD5 26c71de1978922329107df99673326c6
BLAKE2b-256 a45a4bc1aa4805d0545c588fa460c8532d8c3d156f34cd15cf991b9c93ed84df

See more details on using hashes here.

Provenance

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