> -----Original Message-----
> From: M.Lewis
> Sent: Saturday, March 08, 2003 3:56 AM
> Subject: Crontab issue
> 
> 
> 
> If I run the following from the comman line, it works properly:
> 
> /bin/tar czvf /root/dbman_back-`date '+%m%d%Y%H%M'`-tar.gz \  
>               
> /var/www/cgi-bin/dbman
> 
> However, it I put this in my crontab, I get the following:
> 
> Subject: Cron <[EMAIL PROTECTED]> /bin/tar czvf /root/dbman_back-`date '+
> X-Cron-Env: <SHELL=/bin/bash>
> X-Cron-Env: <HOME=/root>
> X-Cron-Env: <PATH=/usr/bin:/bin>
> X-Cron-Env: <LOGNAME=root>
> 
> /bin/bash: -c: line 1: unexpected EOF while looking for matching ``'
> /bin/bash: -c: line 2: syntax error: unexpected end of file
> 
> 
> I realize that cron is picky about ENV and such, but I can't 
> see what I'm  missing here.
> 
> Thanks,
> Mike

As other have pointed out, the % sign has special meaning within a cronjob.
Plus, I think cronjobs do not understand the back-tick assignment of
variables. i.e. DATE=`date ...`

Someone please prove me wrong, but I have always had to create a separate
shell script and then call this script in the cronjob to get this back-tick
(executation of a command) type of assignment to work. i.e.

vi /usr/local/bin/create_tarball
#!/bin/bash

/bin/tar czvf /root/dbman_back-`date '+%m%d%Y%H%M'`-tar.gz \
/var/www/cgi-bin/dbman

and then in my cronjob...
* * * * * /usr/local/bin/create_tarball

Steve Cowles



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to