Coder Social home page Coder Social logo

wummel / chkcrontab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lyda/chkcrontab

0.0 2.0 0.0 124 KB

A tool for checking system crontab files (/etc/crontab and /etc/cron.d normally) for errors and common mistakes.

License: Other

Python 99.13% Shell 0.87%

chkcrontab's Introduction

chkcrontab

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 packaged version is available via pip or easy_install as chkcrontab. The project page is on pypi:

The source code is available in the following locations:

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

Packaging

For rpm distributions, ./setup.py bdist --formats=rpm should make an rpm but currently dies due to not finding the chkcrontab.1 man page.

For Debian distributions there's an additional tool that might work.

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.
  • Make "acceptable filenames" a configurable thing: lyda#4
  • Packaging: lyda#13

Credits

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.