• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Redirect crontab notification to log-file with date in filename

SteffenM

New Pleskian
Hi,
I know may threads are about redirecting the crontab notifications but I haven't found any thread telling how to redirect the output in a file with the date in the filename.
I also know theoretically how to do that, but it doesn't work, so I ask the question here.
What I have tried yet is the following:

/path/to/script/scipt.pl > /var/log/cron/plesk-cron-script_$(date +%y%m%d).log 2>&1

/path/to/script/scipt.pl > /var/log/cron/plesk-cron-script_`date +%Y-%m-%d`.log 2>&1

I have to admit that I'm not sure what exactly the difference is between the two versions. I have read somewhere that it is recommended to use the first version.

When I try the lines above in the linux-shell they work both as I want them to work. But the error-mails from the cron tell something like this:
For the first version:
"/bin/sh: -c: line 0: unexpected EOF while looking for matching `)'
/bin/sh: -c: line 1: syntax error: unexpected end of file"

For the second version:
"/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file"

Can anyone tell me what's my fault?

Greets,
Steffen
 
Back
Top