My web host only keeps the raw apache log for 1 day. I'm trying to copy that file over and rename it with the date. I'm running a BASH script from a cron job. Here is the script that doesn't work
DATEVAR= date --date=yesterday +%Y-%m-%d
cp /...logs/access_log.1 /.../logs_aggregate/
mv /.../logs_aggregate/access_log.1 /.../$DATEVAR
It copies the log file, but doesn't like the $DATEVAR, anything static works fine. If I type 'echo $DATEVAR' it prints yesterdays date in the format I want it, '2006-04-19'
So in a nutshell, I want to copy the log file to a new location and rename it with the revious days date.
I just started with bash scripting, so I know I am overlooking something silly, but I've been working on this off and on for over a week.