cron設定ファイルが見つかりません

cron設定ファイルが見つかりません

CentOS 7があり、設定ファイルにアクセスしようとしています。

# Cron configuration options

# For quick reference, the currently available log levels are:
#   0   no logging (errors are logged regardless)
#   1   log start of jobs
#   2   log end of jobs
#   4   log jobs with exit status != 0
#   8   log the process identifier of child process (in all logs)
#

私の目標はcronロギングを無効にすることです。

インターネット検索をしてみると、何人かの人々が似たようなファイルを持っているようですが、/etc/default/cron検索/etc/rsyslog.d/50-Default.confしてみるとそのようなファイルが一つもありません。クローンログがあり、/etc/rsyslog.confそれを使用して無効にしようとしますがcron.none.* /var/log/messages(どちらもありません/var/log/syslog)、リモートサーバーにはまだクローンログが表示されます。

cronロギングを停止するにはどうすればよいですか(cron自体は停止しません)?私がしたことは彼らを止めることができなかったようです。

ベストアンサー1

CentOS/RHEL 7の使用親友クローンの実装。そこに表示されるファイルはビキシクロン、Debianなどのディストリビューションで使用されます。

[root@centos7 ~]# head -2 /usr/share/doc/cron*/README
17. January 2008        mmaslano (at) redhat (dot) com
Rename the fork on cronie. The source code could be found here:
[root@centos7 ~]#
root@debian:/# head -20 /usr/share/doc/cron*/README
#/* Copyright 1988,1990,1993 by Paul Vixie
# * All rights reserved
# *
# * Distribute freely, except: don't remove my name from the source or
# * documentation (don't take credit for my work), mark your changes (don't
# * get me blamed for your possible bugs), don't alter or remove this
# * notice.  May be sold if buildable source is provided to buyer.  No
# * warrantee of any kind, express or implied, is included with this
# * software; use at your own risk, responsibility for damages (if any) to
# * anyone resulting from the use of this software rests entirely with the
# * user.
# *
# * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
# * I'll try to keep a version up to date.  I can be reached as follows:
# * Paul Vixie          <[email protected]>          uunet!decwrl!vixie!paul
# */

Vixie Cron V3.0
December 27, 1993
[V2.2 was some time in 1992]
root@debian:/#

基本的に、親友すべてのcronメッセージは、次のエントリを/var/log/cron使用して送信されます。/etc/rsyslog.conf

[root@centos7 ~]# grep ^cron /etc/rsyslog.conf
cron.*                                                  /var/log/cron
[root@centos7 ~]#

記録された場所を変更するには、ファイルを変更してrsyslogを再起動します。クローンを再起動する必要はありません。

[root@centos7 ~]# sed -i 's!/var/log/cron!/var/log/bob!' /etc/rsyslog.conf
[root@centos7 ~]# grep ^cron /etc/rsyslog.conf
cron.*                                                  /var/log/bob
[root@centos7 ~]# systemctl restart rsyslog
[root@centos7 ~]# tail /var/log/bob
Jul  7 19:16:41 centos7 crontab[8581]: (root) LIST (root)
Jul  7 19:17:01 centos7 CROND[8587]: (root) CMD (/bin/touch /tmp/foo)
[root@centos7 ~]#

そして@doneal24がエントリを完全に削除することを指摘したように、元の質問によると、/etc/rsyslog.conf次のような行を使用します。

cron.* ~

おすすめ記事