Skip to content

docwhat/chronic

main
Switch branches/tags
Code

Latest commit

Bumps [github/super-linter](https://github.com/github/super-linter) from 4.8.1 to 4.8.2.
- [Release notes](https://github.com/github/super-linter/releases)
- [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md)
- [Commits](github/super-linter@v4.8.1...v4.8.2)

---
updated-dependencies:
- dependency-name: github/super-linter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7c6391f

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Chronic

A tool to hide stdout and stderr when a program runs successfully (i.e., returns exit code 0).

GitHub Actions GitHub release Go Report Card GitHub issues

About

This is a go based version of the classic cronic or chronic tool. Chuck Houpt wrote the original chronic.

Usage

If you've ever used cron to run jobs, you know that it sends an email for any output generated by the command. This is why you see crontabs that look like this:

MAILTO=admin@example.com
PATH=/usr/bin:/bin
0 4 0 0 0 my-noisy-command -vF >/dev/null 2>&1

This is an anti-pattern:

  • If you failed to get the command line correct, then you'll end up getting an email.
  • If anything goes wrong, you've lost the output.
  • If you log to a file, then you have to rotate that log, even if 99% of the contents are useless.

With chronic you don't have to worry about that anymore!

MAILTO=admin@example.com
PATH=/usr/bin:/bin
0 4 0 0 0 chronic my-noisy-command -vF

Now, you'll get no emails unless my-noisy-command returns a non-zero exit code. If it does return a non-zero exit code, then you'll get an email that looks like this:

To: admin@example.com
Subject: [CRON] chronic my-noisy-command -vF

**** command ****
[`bash` `-c` `echo "boo"; echo "emergency" 1>&2; exit 10`]

**** stdout ****
stdout: Normal output from the noisy command.
stdout: Starting messages
stdout: Normal stuff

**** stderr ****
stderr: Standard error output from the noisy command.
stderr:
stderr: [FATAL] Something went wrong!

Exited with 10

Installation

Download binaries

Homebrew

brew install docwhat/tap/chronic

GitHub Releases

The latest release is available on github.com/docwhat/chronic/releases. You can download the binary for your architecture and OS there.

Source

go get docwhat.org/chronic

Compile it yourself

You'll need to install a recent version of Go and set it up. You can check the .travis.yml file to see what version of go I'm using.

go get -u docwhat.org/chronic

Developers

I love contributions! Read CONTRIBUTING.md!