From f55b63de4620166fed7e1a8715b6b4263d965e09 Mon Sep 17 00:00:00 2001 From: Kevin Lyda <kevin@ie.suberic.net> Date: Sat, 26 May 2012 22:24:23 +0100 Subject: [PATCH] Add docs and some utils. --- doc/chkcrontab.1 | 80 ++++++++++++++++++++++++++++++++++++++++++++ doc/chkcrontab.1.rst | 56 +++++++++++++++++++++++++++++++ utils/install-hooks | 11 ++++++ utils/remake-manpage | 11 ++++++ 4 files changed, 158 insertions(+) create mode 100644 doc/chkcrontab.1 create mode 100644 doc/chkcrontab.1.rst create mode 100755 utils/install-hooks create mode 100755 utils/remake-manpage diff --git a/doc/chkcrontab.1 b/doc/chkcrontab.1 new file mode 100644 index 0000000..5299ec9 --- /dev/null +++ b/doc/chkcrontab.1 @@ -0,0 +1,80 @@ +.\" Man page generated from reStructuredText. +. +.TH CHKCRONTAB 1 "" "" "Utilities" +.SH NAME +chkcrontab \- Crontab lint tool +. +.nr rst2man-indent-level 0 +. +.de1 rstReportMargin +\\$1 \\n[an-margin] +level \\n[rst2man-indent-level] +level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] +- +\\n[rst2man-indent0] +\\n[rst2man-indent1] +\\n[rst2man-indent2] +.. +.de1 INDENT +.\" .rstReportMargin pre: +. RS \\$1 +. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] +. nr rst2man-indent-level +1 +.\" .rstReportMargin post: +.. +.de UNINDENT +. RE +.\" indent \\n[an-margin] +.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] +.nr rst2man-indent-level -1 +.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] +.in \\n[rst2man-indent\\n[rst2man-indent-level]]u +.. +.SH SYNOPSIS +.sp +\fBchkcrontab\fP \fIfile\fP +.SH DESCRIPTION +.sp +The \fBchkcrontab\fP command provides a command line tool to check the +correctness of system crontab files like \fB/etc/crontab\fP or the +files in \fB/etc/cron.d\fP. +.sp +The following check are run against the given crontab file. +.INDENT 0.0 +.IP \(bu 2 +File name is a valid cron file name. +.IP \(bu 2 +Variable assignments do not have \fB$\fP\(aqs in right hand side. +.IP \(bu 2 +Confirms that \fB@\fP specifiers are valid. +.IP \(bu 2 +Confirms that users exist on the system (or NIS or LDAP). +.IP \(bu 2 +Validates the basic syntax of cron job lines. +.IP \(bu 2 +Validates that each time field is within limits. +.IP \(bu 2 +Checks that ranges and sequences are not used for the "day of +week" and "month" fields. +.IP \(bu 2 +Reports any bare \fB%\fP in a command. +.UNINDENT +.SH BUGS +.sp +Quite possibly. Report them via the \fI\%issue tracker\fP at the project +website. +.SH SEE ALSO +.sp +\fBlint\fP (1) +.SH RESOURCES +.sp +Project website: \fI\%http://code.google.com/p/chkcrontab\fP +.SH COPYING +.sp +Copyright (C) 2012 Kevin Lyda. +Free use of this software is granted under the terms of the GNU General +Public License version 3 or any later version. +.SH AUTHOR +Kevin Lyda <lyda@google.com> +.\" Generated by docutils manpage writer. +. diff --git a/doc/chkcrontab.1.rst b/doc/chkcrontab.1.rst new file mode 100644 index 0000000..32393f7 --- /dev/null +++ b/doc/chkcrontab.1.rst @@ -0,0 +1,56 @@ +========== +chkcrontab +========== + +----------------- +Crontab lint tool +----------------- + +:Author: Kevin Lyda <lyda@google.com> +:Manual section: 1 +:Manual group: Utilities + + +Synopsis +-------- +**chkcrontab** *file* + +Description +----------- +The **chkcrontab** command provides a command line tool to check the +correctness of system crontab files like ``/etc/crontab`` or the +files in ``/etc/cron.d``. + +The following check are run against the given crontab file. + +* File name is a valid cron file name. +* Variable assignments do not have ``$``'s in right hand side. +* Confirms that ``@`` specifiers are valid. +* Confirms that users exist on the system (or NIS or LDAP). +* Validates the basic syntax of cron job lines. +* Validates that each time field is within limits. +* Checks that ranges and sequences are not used for the "day of + week" and "month" fields. +* Reports any bare ``%`` in a command. + + +Bugs +---- +Quite possibly. Report them via the `issue tracker`_ at the project +website. + +See Also +-------- +**lint** (1) + +Resources +--------- +Project website: http://code.google.com/p/chkcrontab + +Copying +------- +Copyright (C) 2012 Kevin Lyda. +Free use of this software is granted under the terms of the GNU General +Public License version 3 or any later version. + +.. _`issue tracker`: http://code.google.com/p/chkcrontab/issues/list diff --git a/utils/install-hooks b/utils/install-hooks new file mode 100755 index 0000000..a821c3d --- /dev/null +++ b/utils/install-hooks @@ -0,0 +1,11 @@ +#!/bin/bash + +THIS_GIT_DIR="${0%/*}/.." +if [[ ! -f $THIS_GIT_DIR/.git/hooks/pre-commit ]]; then + cat > $THIS_GIT_DIR/.git/hooks/pre-commit << EOF +#!/bin/sh + +./setup.py test +EOF + chmod 755 $THIS_GIT_DIR/.git/hooks/pre-commit +fi diff --git a/utils/remake-manpage b/utils/remake-manpage new file mode 100755 index 0000000..0e17d50 --- /dev/null +++ b/utils/remake-manpage @@ -0,0 +1,11 @@ +#!/bin/bash + +manpages="chkcrontab.1" + +for mp in $manpages; do + if [[ ! -f doc/$mp.rst ]]; then + echo "Can't find $mp.rst - run in base dir." + exit 1 + fi + rst2man.py doc/$mp.rst > doc/$mp +done -- GitLab