Skip to main content

Collection of Python utilities for inspecting and searching crontab.

Project description

jps-crontab-utils

Build Publish to PyPI codecov

Collection of Python utilities for parsing, validating, and searching crontab files.

🚀 Overview

jps-crontab-utils provides three command-line tools:

1. Crontab Parser

Parses raw crontab files into structured job objects:

  • Supports per-job metadata via comment blocks
  • Handles multiline commands with POSIX \ continuation
  • Resolves executables using $PATH or absolute paths
  • Normalizes metadata keys automatically (owner-emailowner_email)

2. Crontab Checker

Validates each cron job for:

  • Required metadata (owner, owner email, reference, repository, etc.)
  • Recommended metadata (labels, run frequency, description, etc.)
  • Executable existence, file type, +x bit, and non-empty status
  • Outputs human-readable tables or JSON for automation

3. Crontab Search Utility

Queries crontab entries based on:

  • Labels (--label nightly)
  • Owner email (--email john.smith)
  • Code repository (--repo git@gitlab.com:org/pipeline.git)
  • Full JSON output for programmatic analysis

These utilities help improve crontab hygiene, enforce team standards, and identify broken or undocumented jobs across large environments.


Features

  • 🔍 Search cron jobs using metadata filters
  • 📝 Parse job schedule, command, metadata
  • 🛠 Validate executables and metadata completeness
  • 📈 Rich terminal tables (typer + rich)
  • 📦 JSON output for CI/CD and automation
  • 🧪 100% test-covered parser and search modules

Example Usage

Parse and inspect a crontab

jps-crontab-parse --file /etc/crontab

Search for jobs labeled “nightly”

jps-crontab-search --file crontab.txt --label nightly

Audit a crontab

jps-crontab-check --file crontab.txt

JSON mode for pipelines

jps-crontab-check --file crontab.txt --json | jq .

📦 Installation

make install
pip install jps-crontab-utils

🧪 Development

make fix && make format && make lint
make test

📜 License

MIT License © Jaideep Sundaram

Documentation

📘 Full documentation: see docs/USAGE.md

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

jps_crontab_utils-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

jps_crontab_utils-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file jps_crontab_utils-0.1.0.tar.gz.

File metadata

  • Download URL: jps_crontab_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jps_crontab_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ddafe7c9de28449703e17cf7a293b59830a6cfdeee7e095b64849186fbacb0da
MD5 4157c5991e2e7b1b2d48d5aeeabb68ea
BLAKE2b-256 32f7f9daf7598505bfce53e0acac1267671ab1e02884b40f0bf143b2726d7eed

See more details on using hashes here.

File details

Details for the file jps_crontab_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jps_crontab_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a19bf53c0331f290d3047e0d4d15824e858c632173980893f9aeab9f60a7aa76
MD5 0d51f9e332077e6976697d7dbe2e3351
BLAKE2b-256 cc29383a2c4887c50ded770c2dc3181d7f503254974e5373fe6477fcf71194b5

See more details on using hashes here.

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