【发布时间】:2020-04-20 02:08:28
【问题描述】:
如何在 crontab 中运行 RM 时为详细标志添加时间戳?
0 06 * * * rm -v /somePath/FileToDelete > /somePath/filetoLog.log
【问题讨论】:
标签: shell cron timestamp verbose
如何在 crontab 中运行 RM 时为详细标志添加时间戳?
0 06 * * * rm -v /somePath/FileToDelete > /somePath/filetoLog.log
【问题讨论】:
标签: shell cron timestamp verbose
一种方法是显式调用date:
0 06 * * * (date && rm -v /somePath/FileToDelete) > /somePath/filetoLog.log
【讨论】:
rm 被重定向。 Mea culpa - 请参阅我编辑的答案。