I want to setup a job that prints output to /dev/stdout, but cron is intercepting it, and sends an e-mail instead
crontab -l
*/1 * * * * echo "hiccup" >> /dev/stdout 2>&1
this is the message:
21 │ From xxx@ltus423288.na.yyy.com Tue May 21 11:13:00 2019
22 │ Return-Path: <xxx@ltus423288.na.yyy.com>
23 │ X-Original-To: xxx
24 │ Delivered-To: xxx@ltus423288.na.yyy.com
25 │ Received: by ltus423288.na.yyy.com (Postfix, from userid 501)
26 │ id EE6752E98EF; Tue, 21 May 2019 11:13:00 +0200 (CEST)
27 │ From: xxx@ltus423288.na.yyy.com (Cron Daemon)
28 │ To: xxx@ltus423288.na.yyy.com
29 │ Subject: Cron <xxx@ltus423288> echo "hiccup" >> /dev/stdout 2>&1
30 │ X-Cron-Env: <SHELL=/bin/sh>
31 │ X-Cron-Env: <PATH=/usr/bin:/bin>
32 │ X-Cron-Env: <LOGNAME=xxx>
33 │ X-Cron-Env: <USER=xxx>
34 │ X-Cron-Env: <HOME=/Users/xxx>
35 │ Message-Id: <20190521091300.EE6752E98EF@ltus423288.na.yyy.com>
36 │ Date: Tue, 21 May 2019 11:13:00 +0200 (CEST)
37 │ Status: O
38 │
39 │ hiccup
I have already configured fluentd that grabs everything from stdout, so I would prefer cron send job logs there. I tried writing to file which is symbolic link to /dev/stdout but it is not working. I am not sure, if I disable sending mails, and order cron to write to /var/log/syslog (and make it symbolic link to /dev/stdout) cron would fail into infinite loop.
stdout
when not connected ? You should read https://unix.stackexchange.com/questions/4126/what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-con – Archemar May 21 '19 at 14:06