简体   繁体   English

Linux 中的 Crontab 输出

[英]Crontab Output in Linux

我已经创建了一个带有一些属性的 crontab,但是我需要它来将执行时间插入到名为 output.out 的输出中,我该怎么做?

using https://crontab-generator.org/使用https://crontab-generator.org/

Put the following in your crontab:将以下内容放入您的 crontab:

*/10 13-15 * * 1-5 run_command >> logfile

An explanation:一个解释:

*/10 - every 10 minutes
13-15 - from 1-3 pm
* - every day
* - every every month
1-5 - monday through friday
\>> - bash append (will add to file, not overwrite on every run)

Simply have your script write to std out when it runs and the output will log the times.只需让您的脚本在运行时写入标准输出,输出就会记录时间。 If you don't have that option you could run如果你没有那个选项,你可以运行

*/10 13-15 * * 1-5 run_command; date >> logfile

Which should echo the date and time to your logfile when the command is executed.当命令执行时,它应该将日期和时间回显到您的日志文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM