.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CHRONIC 1" .TH CHRONIC 1 2024-05-01 moreutils " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME chronic \- runs a command quietly unless it fails .SH SYNOPSIS .IX Header "SYNOPSIS" chronic [\-ev] COMMAND... .SH DESCRIPTION .IX Header "DESCRIPTION" chronic runs a command, and arranges for its standard out and standard error to only be displayed if the command fails (exits nonzero or crashes). If the command succeeds, any extraneous output will be hidden. .PP A common use for chronic is for running a cron job. Rather than trying to keep the command quiet, and having to deal with mails containing accidental output when it succeeds, and not verbose enough output when it fails, you can just run it verbosely always, and use chronic to hide the successful output. .PP .Vb 2 \& 0 1 * * * chronic backup # instead of backup >/dev/null 2>&1 \& */20 * * * * chronic \-ve my_script # verbose for debugging .Ve .SH OPTIONS .IX Header "OPTIONS" .IP \-v 4 .IX Item "-v" Verbose output (distinguishes between STDOUT and STDERR, also reports RETVAL) .IP \-e 4 .IX Item "-e" Stderr triggering. Triggers output when stderr output length is non-zero. Without \-e chronic needs non-zero return value to trigger output. .Sp In this mode, chronic's return value will be \f(CW2\fR if the command's return value is \f(CW0\fR but the command printed to stderr. .SH AUTHOR .IX Header "AUTHOR" Copyright 2010 by Joey Hess .PP Original concept and "chronic" name by Chuck Houpt. Code for verbose and stderr trigger by Tomas 'Harvie' Mudrunka 2016. .PP Licensed under the GNU GPL version 2 or higher.