Crontab with sh message "No MTA installed, discarding output"

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
ruyzz

Crontab with sh message "No MTA installed, discarding output"

Post by ruyzz »

Hi all:

I have a crontab as follows:
/etc/cron.d

Code: Select all

SHELL=/bin/bash
47 10 * * 2 root /bin/example.sh
but when viewing the status, the following appears:

Code: Select all

ene 08 10:47:01 cln-001 cron[703]: (*system*example) RELOAD (/etc/cron.d/example)
ene 08 10:47:01 cln-001 CRON[7152]: pam_unix(cron:session): session opened for user root by (uid=0)
ene 08 10:47:01 cln-001 CRON[7157]: (root) CMD (/bin/example.sh)
ene 08 10:47:01 cln-001 CRON[7152]: (CRON) info (No MTA installed, discarding output)
ene 08 10:47:01 cln-001 CRON[7152]: pam_unix(cron:session): session closed for user root

Can someone tell me if this message is normal or just can not run it as root?

Code: Select all

ene 08 10:47:01 cln-001 CRON[7152]: (CRON) info (No MTA installed, discarding output)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
gm10

Re: Crontab with sh message "No MTA installed, discarding output"

Post by gm10 »

The facts aside that using sudo in a script run by root is superfluous and the idea of dropping caches via cron is, well, no comment, you didn't specifically configure MAILTO="", so cron is trying mail you the output created by your cron job. Output which is only getting created because of that unnecessary sudo tee construct btw. Also: sysctl vm.drop_caches=3.
Locked

Return to “Scripts & Bash”