Wrap cron jobs with timing, output capture, and exit code tracking
Project description
cronguard
Wrap cron jobs with execution tracking, timing, output capture, and exit code reporting.
Install
pip install cronguard
uv add cronguard
brew install cronguard
Usage
Basic run
cronguard run "echo hello"
With a timeout (seconds)
cronguard run "backup.sh" --timeout 300
With a human label
cronguard run "deploy.sh" --label "nightly-deploy"
JSON output (good for piping to monitoring)
cronguard run "test.sh" --json
Quiet mode (only output on failure)
cronguard run "cleanup.sh" --quiet
Drop it in your crontab
# Run backup every night at 2am, timeout after 1 hour
0 2 * * * cronguard run "/home/me/backup.sh" --label "nightly-backup" --timeout 3600 --quiet 2>&1 | logger -t cronguard
The --quiet flag keeps things silent when everything works. If the job fails, cronguard prints the full report so logger (or your monitoring) picks it up.
All options
cronguard run COMMAND [OPTIONS]
Arguments:
COMMAND The command to run
Options:
--timeout, -t FLOAT Timeout in seconds. Exit code 124 on timeout.
--label, -l TEXT Human-readable label for this job.
--json, -j Output results as JSON.
--quiet, -q Only output on failure. Silent success.
Global:
--version, -V Show version and exit.
--help Show this message and exit.
Why I built this
Cron jobs fail silently. You set up a backup script, forget about it, and three months later you find out it has been broken the whole time. I wanted something dead simple that wraps any command and gives you timing, exit codes, and captured output so you can pipe it into whatever alerting you already use. No daemons, no config files, just prefix your cron command with cronguard run and you get visibility.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cronguard-0.1.0.tar.gz.
File metadata
- Download URL: cronguard-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd35f0b47f19a0c79865ab2007143a53797f2568b33cb6b0d26a7a2ac8ec7899
|
|
| MD5 |
e06685597ddd7ad8eb3830a97b6993a6
|
|
| BLAKE2b-256 |
fb54c9359ab8212a80cd43d05149f7e80bc0a1929b27cbf8e00a14600d47342b
|
File details
Details for the file cronguard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cronguard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29889ad0113fb8b7d5a4e2a8d1baff9a01f639c3c4ba48c7c68df0116889c6d7
|
|
| MD5 |
a05c50a372587d6c152aab831b68be4c
|
|
| BLAKE2b-256 |
7374e56adddb3bd573cf87b2197f6d60757fd38c46b281af1b8616f8118b3217
|