Crontab: log stdout and stderr to logfile by current date and time
This crontab-syntax stores the stdout and stderr to a logfile which name consists of the current date and time.
# # Do complex ETL stuff. # Log output to Logfile at specified location, logname is current "date+time".log # 12 7 * * * cd /home/foo/bin; ./run_etljob.sh > /home/foo/log/$(date +\%Y-\%m-\%d_\%H-\%M-\%S).log 2>&1
An example logfile name would be: