I have a php cron job that writes its output to a log file like this:
crontab -l
* * * * * php -f /var/www/cron.php >> /tmp/crons/cron.log
Is there a way of making the log output file dynamic, so that it could write to date('Y-m').cron.log?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’m not sure what cron uses to execute the commands, but in bash you could use backticks. So, with your crontab like this:
and /your/script.sh containing this:
you’ll get that which you desire.