1

I'm trying to use below but it doesn't work:

*/3 * * * * java -jar /opt/Folder1/Utility.jar > /var/log/date +\%Y-\%m-\%d_\%H:\%M:\%S-backup.log 2>&1

Could you pls guide where it went wrong?

ref: Sending cron output to a file with a timestamp in its name

thanks

Khaled
  • 35,688
  • 8
  • 69
  • 98
Sohan
  • 11
  • 1
  • 3

1 Answers1

2

Your cron job seems OK except that it is missing the back ticks around thedate` command. You need to write the log file name as follows:

/var/log/`date +\%Y-\%m-\%d_\%H:\%M:\%S`-backup.log
Khaled
  • 35,688
  • 8
  • 69
  • 98