본문 바로가기

System/Linux

No configuration file found at /root/.esmtprc or /etc/esmtprc

0. 들어가며

Rocky OS를 운영하며 제목과 같은 에러가 주기적으로 /var/log/messages에 발생하는것을 확인 할 수 있었습니다.

해당 메시지는 crontab에 등록된 작업이 실패 할 경우에 다량으로 발생하는것을 확인하였는데,

이 글은 위에 대한 조치 방안에 대해서 작성하였습니다.

1. 발생 원인

cron은 기본적으로 작업 실행 결과에 대한 내용을 메일로 발송하게끔 구성되어있습니다.

이로 인해  crontab에서 시행한 결과를 발송하려했으나, 서버내에 메일에 대한 설정이 없을 경우에

제목과 같은 에러가 발생합니다.

 

2. 조치 방안

조치 방안은 크게 두가지 방안이 있습니다.

 

2-1) 메일 프로세스 설치

간단한 조치 방법으로 메일서버를 설치해주면 해당 에러는 더이상 발생하지 않습니다.

[root@test ~]# dnf install postfix

==============================================================================================================================================================================================================
 꾸러미                                          구조                                           버전                                                     저장소                                          크기
==============================================================================================================================================================================================================
설치 중:
 postfix                                         x86_64                                         2:3.5.8-7.el8                                            baseos                                         1.5 M

연결 요약
==============================================================================================================================================================================================================

 

2-2) crond mail disable

서버 용도, 환경에 따라 메일 서버 설치가 어려운 경우에 crond 실행 결과 메일 발송을 비활성화 할 수 있습니다. 

man crond 중에 -m 옵션에 대한 내용입니다.

[root@test ~]# man crond
##중략##
-m     This  option allows you to specify a shell command to use for sending Cron mail output instead of using sendmail(8) This command must accept a fully formatted mail message (with headers)
              on standard input and send it as a mail message to the recipients specified in the mail headers.  Specifying the string off (i.e., crond -m off) will disable the sending of mail.

 

뒤에 내용을 보면 -m off를 통해 크론메일전송을 비활성화 할 수 있다는 내용이 있습니다.

아래와 같이 설정 및 재기동 해줍니다.

[root@test ~]# vi /etc/sysconfig/crond

# Settings for the CRON daemon.
# CRONDARGS= :  any extra command-line startup arguments for crond
CRONDARGS="-m off"

[root@test ~]# systemctl restart crond

 

 

 

'System > Linux' 카테고리의 다른 글