Dynamically create log file with date in the name

Is it possible to write out a log file with custom parameters where it writes to a new file based on the date? Something like....

backup_job_name-"date +"%d-%m-%Y"".log

It appears the script doesn't run if that log-file isn't found, so I'm trying to dynamically create the file(s) before it runs.

What's the easiest way to acomplish?

try

rclone lsd . --log-level=DEBUG --log-file=/home/user01/rclone/log/`date +%Y%m%d.%I%M%S`.log

This is the response from rclone.

2021/11/20 12:44:46 Failed to open log file: open /home/dmkjr/backup/log/20211120.124446.log: no such file or directory

Does the directory exist?

That's what it was. Thanks. Wasn't sure if it could create the file, but didn't think about the directory.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.