How to notify users of crontab execution results by email

How to notify users of crontab execution results by email

symptom

I set a crontab task on a centos7 host, but when the time comes, I run mail and it prompts No mail, which means cron did not send an email to notify the user of the execution result of the task.

Troubleshooting process

Check crontab log

CentOS logs are managed by systemd, so you can view related logs through systemctl.

journalctl _COMM=crond --since=today

Or use root to view the log /var/log/cron

sudo cat /var/log/cron |grep -v '/usr/local/qcloud/stargate/admin/start.sh'

Finally, we will see a line in the log: Jun 22 00:50:19 localhost CROND[21181]: (lujun9972) MAIL (mailed 102 bytes of output but got status 0x004b#012)

This means that the email failed to be sent.

Check the mail log

Check /var/log/maillog and you will find Jun 22 00:50:19 localhost postfix/sendmail[21403]: fatal: parameter inet_interfaces: no local interface found for ::1

That is to say, mail prompts that it cannot find the corresponding network card for the IPV6 address ::1 on the host.

Workaround

postfix/postdrop[5487]: warning: unable to look up public/pickup: No such file or directory

After searching, I just need to create the missing file myself and then restart the postfix service.

sudo mkfifo /var/spool/postfix/public/pickup
sudo chown postfix:postdrop pickup
systemctl restart postfix.service

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM.

You may also be interested in:
  • Django-crontab implements sample code for scheduled tasks on the server
  • Detailed explanation of the use and precautions of crontab under Linux
  • How to automatically execute the task schedule crontab every few minutes in a specified time period on Linux
  • Use crontab to run the script of executing jar program regularly in centOS6
  • Laravel solves the problem of crontab not executing
  • Analysis of the operation method of Django crontab timing task module

<<:  How to install MySQL 5.7 from source code in CentOS 7 environment

>>:  Vue implements the method example of tab routing switching component

Recommend

Vue Learning - VueRouter Routing Basics

Table of contents 1. VueRouter 1. Description 2. ...

Solution to BT Baota Panel php7.3 and php7.4 not supporting ZipArchive

The solution to the problem that the PHP7.3 versi...

A brief discussion on CSS height collapse problem

Performance For example: HTML: <div class=&quo...

Handwriting implementation of new in JS

Table of contents 1 Introduction to the new opera...

Detailed explanation of the use of find_in_set() function in MySQL

First, let’s take an example: There is a type fie...

Method for comparing the size of varchar type numbers in MySQL database

Create a test table -- --------------------------...

MySQL database Load Data multiple uses

Table of contents Multiple uses of MySQL Load Dat...

MySQL learning notes: data engine

View the engines supported by the current databas...

Detailed explanation of Vue login and logout

Table of contents Login business process Login fu...

Nginx implements https website configuration code example

https base port 443. It is used for something cal...

Detailed tutorial on using the tomcat8-maven-plugin plugin in Maven

I searched a lot of articles online but didn'...

Use Navicate to connect to MySQL on Alibaba Cloud Server

1. First enter the server's mysql to modify p...

Implementation of Element-ui Layout (Row and Col components)

Table of contents Basic instructions and usage An...

Basic usage tutorial of MySQL slow query log

Slow query log related parameters MySQL slow quer...