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

Solutions to problems using addRoutes in Vue projects

Table of contents Preface 1. 404 Page 1. Causes 2...

How to use JavaScript to implement sorting algorithms

Table of contents Bubble Sort Selection Sort Inse...

Getting Started: A brief introduction to HTML's basic tags and attributes

HTML is made up of tags and attributes, which are...

Common repair methods for MySQL master-slave replication disconnection

Table of contents 01 Problem Description 02 Solut...

How to dynamically add ports to Docker without rebuilding the image

Sometimes you may need to modify or add exposed p...

jQuery implements a simple carousel effect

Hello everyone, today I will share with you the i...

CSS achieves the effect of aligning multiple elements at both ends in a box

The arrangement layout of aligning the two ends o...

Detailed steps for deploying Tomcat server based on IDEA

Table of contents Introduction Step 1 Step 2: Cre...

Nginx installation error solution

1. Unzip nginx-1.8.1.tar.gz 2. Unzip fastdfs-ngin...

Detailed explanation of CSS3 elastic expansion box

use Flexible boxes play a vital role in front-end...

Detailed explanation of CSS float property

1. What is floating? Floating, as the name sugges...