LoginSignup
0
2

More than 5 years have passed since last update.

Cronにてエラーを見たいときPostFixを使ってみよう

Posted at

cronで何か実行したときエラーが見れない。
そういう時いかんせん。

解法

apt install postfix

postfixを入れればいい。公開する必要はないので、途中の質問でLocal Onlyを選べばよろしい。

エラーの見方

 cat /var/mail/root

rootでなくても、適宜ユーザー名で。

From root@localhost  Wed Oct 31 06:25:05 2018
Return-Path: <root@localhost>
X-Original-To: root
Delivered-To: root@localhost
Received: by localhost (Postfix, from userid 0)
    id aaaaaa; Wed, 31 Oct 2018 06:25:05 +0000 (UTC)
From: root@localhost (Cron Daemon)
To: root@localhost
Subject: Cron <root@localhost> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <LOGNAME=root>
Message-Id: <aaaa.aaaaa@localhost>
Date: Wed, 31 Oct 2018 06:25:05 +0000 (UTC)

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/*log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

何かあるならば、最終行にエラーが表示されます。

Ref

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2