Is there a way I can include the command that was executed in the output when I'm logging to a file? For example:
* * * * * date && /path/to/php /path/to/script.php >> cron.log 2>&1
Gives me:
Wed Oct 2 14:56:50 PDT 2013
output from script
How can I include the executed command too, to make the log look like this:
Wed Oct 2 14:56:50 PDT 2013
/path/to/php /path/to/script.php
output from script
I'm looking to add this in the crontab and not in the script.
Shamelessly putting together the excellent points of @Zoredache and @Glenn in comments, you can wrap your
cron
command insidebash -xc
like this: