[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: crontab and command expansion problem



Isaac Claymore wrote:

WEEK_DAY=`date +\%A`
30 23 * * * mount /backup && mysqldump --password=FOOBAR --all-databases > /backup/alldb-${WEEK_DAY}.sql; umount /backup

It's been working on RH system, but the Debian cron keeps refusing to do command
expansion on WEEK_DAY, i.e. the script produces a file named: alldb-`date +\%A`.sql

Any hint?
A little on the simple-minded side, but have you considered just not
using the variable?  I have a cron job that does

12 4 * * 2 /some/script | mail -s "Info for `date +'\%B \%-d, \%Y'`" ad@dr.ess

and it has never given me any trouble.

Thanks, but I've got multiple crontab entries that use `date +\%A`, so it looks
better to me to assign it to a variable.

I would probably take your backup sequence and make a script in /etc/cron.daily

It would give you much more flexability for what you want to do.


~ Darryl



Reply to: