summaryrefslogtreecommitdiffstats
path: root/debian/cronic.1
blob: 40228f6f4d1c27b8cfcbded3e51bc904851b640f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.\" man file for cronic
.TH cronic "1" "May 2018 - v3" "admin" "admin"
.SH NAME
cronic \- a shell script to help control the most annoying feature of cron:
unwanted emailed output
.SH SYNOPSIS
.B cronic 
[\fICOMMAND\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
Cronic is a small shim shell script for wrapping cron jobs so that cron only
sends email when an error has occurred.
.PP
Cronic defines an error as any non-trace error output or a non-zero result
code.
.PP
Cronic filters Bash execution traces (or anything matching \fBPS4\fR) from
the error output, so jobs can be run with execution tracing to aid forensic
debugging.
.PP
Cronic has no options, it simply executes its arguments.
.PP
\fI0 1 * * * \fR\fBcronic\fR \fibackup\fR
.PP
With cronic, you can turn on Bash's strict error handling and debug options
(exit on error, unset variable detection and execution tracing) to make sure
problems are caught early.
.PP
.SH EXAMPLES
.B Example cron job:
.PP
.nf
.RS
#!/bin/bash
set \-o errexit \-o nounset \-o xtrace
cp \-rp data1 /backup
cp \-rp data2 /backup
cp \-rp data3 /backup
.RE
.fi
.PP
When an error is detected, Cronic outputs a report listing the result code,
error output, and combined trace and error output. The combined output can
help put error messages in context.
.PP
.B Example email from cron with cronic info:
.PP
.nf
.RS
From: user@example.net (Cron Daemon)
To: user@example.net
Subject: Cron <user@server> cronic backup

Cronic detected failure or error output for the command:
backup

RESULT CODE: 1

ERROR OUTPUT:
cp: data2: Permission denied

STANDARD OUTPUT:

TRACE-ERROR OUTPUT:
+ cp \-rp data1 /backup
+ cp \-rp data2 /backup
cp: data2: Permission denied
.RE
.fi
.PP
.SH VERSION HISTORY
\fBv3\fR \- Use mktemp \-d to avoid race-conditions and security problems.
.PP
\fBv2\fR \- Corrected command evaluation, so shell meta-chars are preserved
correctly (Thanks to Frank Wallingford for the fix).
.PP
\fBv1\fR \- Initial release.
.SH OTHER TOOLS
Joey Hess has written a simpler perl version of cronic, named chronic.
It is available in Debian as part of \fImoreutils\fR.
.SH AUTHOR
Cronic was written by Chuck Houpt.
.br
This man page was formatted from the cronic home page by Daniel Lange.
.SH "REPORTING BUGS"
Please report bugs upstream to Chuck Houpt <chuck@habilis.net> and use the Debian
bugtracker for Debian-specific issues.
.br
The cronic home page is <https://habilis.net/cronic/>.
.SH COPYRIGHT
Copyright \(co 2007-2016 Chuck Houpt. Debian packaging \(co 2016, 2018 Daniel Lange.
.br
License CCO: Public Domain dedication v1.0 <https://creativecommons.org/publicdomain/zero/1.0/>.
.br
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH "SEE ALSO"
.BR crontab(5),
.BR bash(1)
.\" end of man file for cronic. Daniel Lange 180506, man v1.2 for cronic v3

© 2014-2024 Faster IT GmbH | imprint | privacy policy