我正在运行 CentOS 5.3 并想记录来自“at”守护进程的所有消息。我的 syslog.conf 包含以下条目:
cron.* /var/log/cron
Run Code Online (Sandbox Code Playgroud)
我假设 syslog 中的 cron 行是指“cron、anacron、at 和 batch”的整个系列。然而,虽然 cron 和 anacron 操作似乎被 looged,但“at”操作不会被记录。我如何记录 atd 操作?
感谢您的关注
(已添加)我想添加我的 syslog.conf 的内容,以防出现错误:
# Log all kernel messages to the console.
# Logging much else clutters up the screen.
#kern.* /dev/console
# Log anything (except mail) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;cron.none /var/log/messages
# The authpriv file has restricted access.
authpriv.* /var/log/secure
# Log all the mail messages in one place.
mail.* -/var/log/maillog
# Log cron stuff
cron.* /var/log/cron
# Everybody gets emergency messages
*.emerg *
# Save news errors of level crit and higher in a special file.
uucp,news.crit /var/log/spooler
# Save boot messages also to boot.log
local7.* /var/log/boot.log
Run Code Online (Sandbox Code Playgroud)
从查看 'at' 程序的源代码(来自 CentOS 5.3 源代码库)来看,它看起来确实在记录到 syslog,但只记录了有关 at 守护程序本身的致命错误(例如,如果您尝试运行2 同时在守护进程中)。
但是,进程执行、结果返回代码和标准错误/输出根本不会记录到系统日志中。即使在打开调试(需要重新编译)时,日志消息的信息量也不大(对于最终用户),并且会写如下内容:
atd[24116]: pid 24121 exited with status 0.
Run Code Online (Sandbox Code Playgroud)
这对您确定运行了哪个命令、哪个用户或其标准输出/错误是什么没有多大帮助。
atd确实会向请求命令的用户发送电子邮件通知,以防命令失败或在其标准输出/错误中产生任何内容。但是对于没有任何输出而成功的命令,则不会发送邮件。您可以使用 -m 标志更改它。
从(1) 开始:
-m 在作业完成时向用户发送邮件,即使没有输出。
归档时间: |
|
查看次数: |
5763 次 |
最近记录: |