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
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