Run commands with a cron expression or loop mode
Project description
cronrun
cronrun is a CLI tool to run commands in either:
- cron mode:
cronrun "<CRONTAB_LINE>" - loop mode:
cronrun --loop <command> [args...]
It is a foreground process (not a daemon): schedules exist only while cronrun is running.
Install
pipx install cronrun
Quick Start
# cron mode: run every minute
cronrun "* * * * * echo hello"
# loop mode: run immediately after each completion
cronrun --loop /bin/echo hello
# loop mode with shell expression
cronrun --loop "date; sleep 2"
Usage
cron mode
cronrun "<minute> <hour> <day-of-month> <month> <day-of-week> <command> [args...]"
- The first 5 fields are parsed as the cron expression
- The rest is treated as one command string and executed through shell (
/bin/sh -cequivalent) - No overlap protection: if the next schedule arrives while a previous run is still running, a new run starts
Examples:
cronrun "*/5 * * * * php worker.php"
cronrun "0 2 * * * ./backup.sh"
cronrun "* * * * * flock -n /tmp/worker.lock php worker.php"
loop mode
cronrun --loop <command> [args...]
- Repeats:
run -> wait -> run again - Restarts immediately after each completion
- Commands run through shell
- Single argument is treated as the shell command string directly
- Multiple arguments are composed into one command string, then executed
Examples:
cronrun --loop "date; sleep 2"
cronrun --loop echo hello
cronrun --loop flock -n /tmp/worker.lock php worker.php
Signal Handling
On SIGINT (Ctrl+C) or SIGTERM:
- Stop starting new runs
- Wait for currently running child processes
- Exit after they finish
If no child process is running, it exits immediately.
Timezone and DST
- Schedule evaluation uses OS local timezone
- No tool-specific timezone option is provided
- DST transitions follow local time behavior
Exit Codes
0: normal exit (--help,--version, or graceful stop by signal)1: input or validation errors (invalid cron, missing command, invalid arguments)
Notes
- Error messages are emitted to
stderraserror: <message> cronrundoes not manage crontab files, persistent daemonization, job history, or logging
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
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 cronrun-1.0.0.tar.gz.
File metadata
- Download URL: cronrun-1.0.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d509c88af7c07ce4b66265591c495e2ac80b2519905cac7a5dc1e3d47021e9ee
|
|
| MD5 |
68004b4ebb201a712b740ab6c6e84921
|
|
| BLAKE2b-256 |
336d45434a59d5b6e39317f3ddc741d9013a274117c05f5e2997466b1f9033ce
|
Provenance
The following attestation bundles were made for cronrun-1.0.0.tar.gz:
Publisher:
release.yml on tanakamasayuki/cronrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cronrun-1.0.0.tar.gz -
Subject digest:
d509c88af7c07ce4b66265591c495e2ac80b2519905cac7a5dc1e3d47021e9ee - Sigstore transparency entry: 1040117754
- Sigstore integration time:
-
Permalink:
tanakamasayuki/cronrun@fd564f60ed50c97b335d8bfe3d87b189672f2ca5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tanakamasayuki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fd564f60ed50c97b335d8bfe3d87b189672f2ca5 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file cronrun-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cronrun-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447c29137e7d790482d3299dcd58ce2b3575abaefbfd3c0a1106d172a8e33dab
|
|
| MD5 |
3798782d4ec6576b80f80b9879091cb7
|
|
| BLAKE2b-256 |
183d1d5023503d3f2c9d4a247339b8bb2ef6d99fe8f5bbcd27b569f368f4e5c4
|
Provenance
The following attestation bundles were made for cronrun-1.0.0-py3-none-any.whl:
Publisher:
release.yml on tanakamasayuki/cronrun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cronrun-1.0.0-py3-none-any.whl -
Subject digest:
447c29137e7d790482d3299dcd58ce2b3575abaefbfd3c0a1106d172a8e33dab - Sigstore transparency entry: 1040117860
- Sigstore integration time:
-
Permalink:
tanakamasayuki/cronrun@fd564f60ed50c97b335d8bfe3d87b189672f2ca5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/tanakamasayuki
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@fd564f60ed50c97b335d8bfe3d87b189672f2ca5 -
Trigger Event:
workflow_dispatch
-
Statement type: