1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Redirect crontab notification to log-file with date in filename

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by SteffenM, Mar 31, 2011.

  1. SteffenM

    SteffenM New Pleskian

    15
    85%
    Joined:
    Jun 9, 2010
    Messages:
    8
    Likes Received:
    0
    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
     
Loading...