Skip to main content

A tool to detect crontab errors

Project description

Build status

Crontab linter

chkcrontab is a script to check crontab files like those in /etc/cron.d and /etc/crontab. It tries to catch glaring errors and warn on suspect lines in a crontab file. Some valid lines will generate warnings. Certain silly yet valid crontab lines will generate errors as well.

Run this by doing:

chkcrontab crontab_file

Errors will cause a non-zero exit code. Warnings alone will not.

To see sample output for a bad crontab, run the following:

./chkcrontab ./tests/test_crontab

See the ./tests/test_crontab.disable crontab for how to disable warnings and errors.

Contributions

Contributions are welcome! Please add unit tests for new features or bug fixes. To run all the unit tests run ./setup test. If you have tox installed, just run tox.

You can review coverage of added tests by running coverage run setup.py test and then running coverage report -m.

Note that tests are run on Travis for all supported python versions whenever the tree on github is pushed to.

The code is available in the following locations:

Pull requests on any of those platforms or emailed patches are fine. Opening issues on github is easiest, but I’ll check any of them.

TODO

  • Look for duplicate entries. Puppet sometimes loads up crontabs with dups.

  • Check for backticks. (why?)

  • Make sure MAILTO and PATH are set (perhaps others?).

  • Add tests for command line.

Credits

  • Kevin Lyda: Who got burned one too many times by broken crontabs.

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

chkcrontab-1.5.tar.gz (23.0 kB view details)

Uploaded Source

File details

Details for the file chkcrontab-1.5.tar.gz.

File metadata

  • Download URL: chkcrontab-1.5.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for chkcrontab-1.5.tar.gz
Algorithm Hash digest
SHA256 f78989fb6a1acd702707e83295efe9aa1ac2f98dda1c07fceb07ba810949e039
MD5 27cb76bf54d1a0a9604cfeb0ff7b9d38
BLAKE2b-256 dde02afec653b3043258e94f99444a06d7c726787b70d41a4b3ba091f445f887

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