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 [email protected] Tue May 21 11:13:00 2019
22 │ Return-Path: <[email protected]>
23 │ X-Original-To: xxx
24 │ Delivered-To: [email protected]
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: [email protected] (Cron Daemon)
28 │ To: [email protected]
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: <[email protected]>
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 unix.stackexchange.com/questions/4126/…