Skip to content
A tool for checking system crontab files (/etc/crontab and /etc/cron.d normally) for errors and common mistakes.
Python Shell
Pull request Compare This branch is 22 commits behind lyda:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
doc
tests
utils
.gitignore
.pylintrc
.travis.yml
LICENSE
MANIFEST.in
OWNERS
README.rst
chkcrontab
chkcrontab_lib.py
setup.py
tox.ini

README.rst

chkcrontab

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 main site for this is on code.google.com with a backup site at github. Use whichever is convenient, the maintainer will push accepted patches to both.

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.
Something went wrong with that request. Please try again.