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

Re: Can't get this crontab entry to work



On Tue, Dec 16, 2003 at 04:45:06PM +0000, Colin Watson wrote:
| On Tue, Dec 16, 2003 at 08:22:43AM -0800, David wrote:
| >  12 8 * * * tar -cf /lin2/backup_deb_`date +%m%d%y` /home /etc /var/www
| > 
| >  I keep getting the following error message in my mailbox from cron:
| > 
| >  /bin/sh: -c: line 1: unexpected EOF while looking for matching ``'
| >  /bin/sh: -c: line 2: syntax error: unexpected end of file
| > 
| > What am I doing wrong?
| > 
| > I was able to run the cron job without the time stamp, but now I really
| > would like to add it and I don't seem to be having much luck.  I think
| > its the backtics that are giving me the problem.
| 
| No, it's the percent signs, which are special in crontabs. See 'man 5
| crontab' and search for %.
| 
| Try this instead:
| 
|   12 8 * * * tar -cf /lin2/backup_deb_`date +\%m\%d\%y` /home /etc /var/www

See crontab(5).  '%' is an end-of-command delimiter in cron jobs.
This is why it needs to be escaped.

-D

-- 
If you want to know what God thinks about money,
just look at the people He gives it to.
    -- Old Irish Saying
 
www: http://dman13.dyndns.org/~dman/            jabber: dman@dman13.dyndns.org

Attachment: pgpWzUvg9I5GN.pgp
Description: PGP signature


Reply to: