pytocron
pytocron is a cron implementation targeting containers, written in Python, with seconds and year resolution, native support for Healthchecks.io and >90% test coverage. It is licensed under GNU Affero General Public License v3.0 or later and is meant to remain simple and maintainable.
One particular prime use case is to feed uptime monitoring. For example, here is how I monitor availability of my blog:
# hc-ping: https://hc-ping.com/00000000-0000-0000-0000-000000000000
*/30 * * * * * * wget -qO- -T2 https://blog.hartwork.org/ | grep -qF 'Hartwork Blog'
This would make pytocron check the blog for availability every 30 seconds and
ping Healthchecks.io with the resulting exit code
because of the # hc-ping: <URL> comment line.
Regarding name "pytocron": It was inspired by the term pytosquatting and it had no search results on Google.
If you like pytocron, please support it with a star!
Installation
# pip3 install pytocron
or
# pipx install pytocron
Usage
# pytocron --help
usage:
pytocron [OPTIONS] CRONTAB
pytocron --help
pytocron --version
Container cron with seconds resolution
positional arguments:
CRONTAB Path to crontab file
options:
-h, --help show this help message and exit
--log-level {DEBUG,ERROR,INFO}
Logging level (default: INFO)
--pretend Do not actually run commands (default: do run commands)
--version show program's version number and exit
environment variables:
NO_COLOR Disable use of color (default: auto-detect)
SENTRY_DSN Sentry [d]ata [s]ource [n]ame URL
SENTRY_ENVIRONMENT Sentry Environment (default: "production")
SENTRY_RELEASE Version or Git SHA1 to use with Sentry
Software libre licensed under AGPL v3 or later.
Brought to you by Sebastian Pipping <sebastian@pipping.org>.
Please report bugs at https://github.com/hartwork/pytocron/issues — thank you!
# pytocron --log-level ERROR <(echo '*/2 * * * * * * LC_TIME=C date') # syntax needs Bash
Thu May 15 02:36:06 CEST 2025
Thu May 15 02:36:08 CEST 2025
Thu May 15 02:36:10 CEST 2025
^C
Comparison with other crons
| pytocron | Supercronic | Vixie Cron | |
|---|---|---|---|
| Written in | Python | Go | C |
| Container support | |||
| ∟ Targets | containers | containers | non-container systems |
| ∟ Environment variables | kept | kept | ? |
| ∟ Multi-user mode | ✘ | ✘ | ✔ |
| ∟ Logging target | stdout, stderr | stdout, stderr | syslog or log file |
| ∟ Log rotation support | ✘ | ✔ | ✔ |
| ∟ Command shell | bash -e -u |
/bin/sh |
/bin/sh |
| ∟ Daemonization | ✘ | ✘ | ✔ |
| ∟ Crontab reloading | ✘ | ✔ | ✔ |
| Integrations | |||
| ∟ Support for Healthchecks.io | ✔ | ✘ | ✘ |
| ∟ Support for Sentry | ✔ | ✔ | ✘ |
| Crontab syntax | |||
| ∟ Seconds and year resolution | ✔ (forced) | ✔ (optional) | ✘ |
| ∟ Implementation | croniter | cronexpr | custom |
| Exceeded job runtime handling | auto-kill | overlapping or skips | ? |
| Handling of daylight saving time | skips, duplicates | ? | ? |
| Reaction to NTP adjustments | none | ? | ? |
| Signal handling | |||
∟ SIGHUP |
shutdown | shutdown | log file reopen |
∟ SIGUSR2 |
shutdown | crontab file reload | shutdown |
Contributing
Prior to opening pull requests, please create an issue to discuss the matter first. Thank you!
Security
If you believe to have found a security issue within pytocron, please reach out via e-mail. Thank you!
Support
Please report any bugs that you find.
Like this tool? Support it with a star!
Metadata
Release files for pytocron 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytocron-2.1.0.tar.gz | 23.7 kB | Without provenance | Details for pytocron-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytocron-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for pytocron-2.1.0-py3-none-any.whl |
Total release size: 52.6 kB
Release files / pytocron-2.1.0.tar.gz
| Download URL | pytocron-2.1.0.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b470a9b0044b46cc7c2eb8809aa2a148b2ce40d0d26a678112e9b0df8a0a8d64
|
|
BLAKE2b-256 checksum How to use checksums |
9ca15046917e9da5ef5a61952177e41b8f652cde464e2335187faa7aa48e3a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / pytocron-2.1.0-py3-none-any.whl
| Download URL | pytocron-2.1.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
62e09c2e5018b942c92b568facdf83cb611301bd1dcc02d5c8ff084eee9520e2
|
|
BLAKE2b-256 checksum How to use checksums |
5138025d60b2cae964e56996137bdc3fdc2bf49a496233fead0b5cb2f3265673
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for pytocron 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.