Search code examples
shellcrontimestampverbose

RM output log with timestamp in crontab


How can one timestamp the verbose flag when running RM in a crontab?

0 06 * * *  rm -v /somePath/FileToDelete > /somePath/filetoLog.log

Solution

  • One approach could be to call date explicitly:

    0 06 * * *  (date && rm -v /somePath/FileToDelete) > /somePath/filetoLog.log