Cronic - A cure for Cron's chronic email problem
21–30 of 47 posts
Re: Cronic - A cure for Cron's chronic email problem
#22Since this is hackernews, can someone explain the rational behind putting the 2>&1 after the > ? I know it works, but this reads to me: command > file.txt 2>&1 "write the output of command to file.txt and then map the error output to stdout" It makes so much more sense to write: command 2>&1 > file.txt There is clearly something in my brain that is confused about how redirection works.
$ ls x
ls: cannot access x: No such file or directory
$ ls x >/dev/null 2>&1
$ ls x 2>&1 >/dev/null
ls: cannot access x: No such file or directory
The first command shows us trying to list a non-existent file, raising an error. The second sends stderr to stdout before sending stdout to null, suppressing all output. The third sends the error to stdout; any output on stdout would have been suppressed (can you come up with a way to verify this?)Re: Cronic - A cure for Cron's chronic email problem
#23Utilities should not print out anything that the user can safely ignore. If you want to print out more info, add a VERBOSE mode (-v or -vv ...).
Re: Cronic - A cure for Cron's chronic email problem
#24I have this problem, I only want to be emailed upon failure. However, the crontab of the account is shared by several different jobs run by different people, and I don't have control over that. Perhaps I could set the email in the crontab line? * * * * * MAILTO=me@example.com blahscript.sh
blahscript.sh | mail -s "Subject" me@example.comRe: Cronic - A cure for Cron's chronic email problem
#25Writing programs like this must be a rite of passage. About a year ago I wrote one ( https://github.com/mlaiosa/cronwrap ). One day when I googled "cronwrap" to try to find the github page, there was a gazillion hits of other programs that also did the same thing. I looked at a couple and I still like mine more - but I also have a moderate case of not-invented-here syndrome.
Re: Cronic - A cure for Cron's chronic email problem
#26Re: Cronic - A cure for Cron's chronic email problem
#27Oh man. I was all excited reading the headline until I realized that you weren't talking about a cure for Crohn's.
Unfortunately the FDA has ruled that this treatment would require approval. The approval process is expensive, and there is no way that anyone can recoup their expenses for doing so. Therefore this treatment will never be approved in the USA.
But I know someone who had severe Crohn's disease who went to Canada to receive a mail order of hookworm. Thanks to that he's been totally off drugs for over a year, and shows no signs of the disease.
Re: Cronic - A cure for Cron's chronic email problem
#28In a dozen or so years of administrating many different Unix machines, I've never had cron email be a problem and I get a few (useful) emails from various cron scripts every day. This interacts badly with many unix commands, which often send status info to standard out. Some commands have a quiet options, but that can turn off all error output too. Maybe it's that I've mostly been administrating BSD machines, and so…
I think it's an OSX-ism. Most OSX devs I've seen treat their command-line utilities like their GUI utilities, with nice looking albeit chatty output. These utilities then get released into the Linux world, where they often work without any modification.
Re: Cronic - A cure for Cron's chronic email problem
#29I like how the web page switches to two-column layout if it has enough screen space.
Re: Cronic - A cure for Cron's chronic email problem
#30I have this problem, I only want to be emailed upon failure. However, the crontab of the account is shared by several different jobs run by different people, and I don't have control over that. Perhaps I could set the email in the crontab line? * * * * * MAILTO=me@example.com blahscript.sh
blahscript.sh | mail -s "Subject" me@example.com