cron problem

cron problem

Post by newyorkd.. » Wed, 16 Feb 2000 04:00:00



Hi,

I have a nightly backup running via cron....

0 4 * * 1-5 /usr/local/bin/perform_backup >/u00/backup/`date +"%d-%b-%
Y"`.log 2>&1

The problem is with name of the .log file I'm trying to create. The
date command seems to be issuing the 'whole' date format instead of "%d-
%b-%Y" and there is no .log appended to the end eg. I am getting:

Tue Feb 15 04:00:00 GMT 2000

as the name of the log file. Can I do this kind of date formatting in
cron?

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

cron problem

Post by peter_rei.. » Wed, 16 Feb 2000 04:00:00




> Hi,

> I have a nightly backup running via cron....

> 0 4 * * 1-5 /usr/local/bin/perform_backup >/u00/backup/`date +"%d-%b-%
> Y"`.log 2>&1

> The problem is with name of the .log file I'm trying to create. The
> date command seems to be issuing the 'whole' date format instead of "%
d-
> %b-%Y" and there is no .log appended to the end eg. I am getting:

> Tue Feb 15 04:00:00 GMT 2000

> as the name of the log file. Can I do this kind of date formatting in
> cron?

> Sent via Deja.com http://www.deja.com/
> Before you buy.

I got round this by defining the log file name inside the script, and
appending output from commands to the log:

command >>$LOG

Good Luk,

Pete

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

cron problem

Post by Nick » Fri, 18 Feb 2000 04:00:00


Better put this "data  bla-bla-bla" inside the script.
AS YOU SEE, crontab syntax is not the same as shell syntax.
I know this by experience also, never saw that in manuals.
Having learned to use only simple commands in 'crontab' on Solarises
I keep this style in AIX, too. If you are not able to correct the
script,
wrap it with another one and don't waste your time.

And of course, I'd like to read answer better, then myself's one.

Nick.


> Hi,

> I have a nightly backup running via cron....

> 0 4 * * 1-5 /usr/local/bin/perform_backup >/u00/backup/`date +"%d-%b-%
> Y"`.log 2>&1

> The problem is with name of the .log file I'm trying to create. The
> date command seems to be issuing the 'whole' date format instead of "%d-
> %b-%Y" and there is no .log appended to the end eg. I am getting:

> Tue Feb 15 04:00:00 GMT 2000

> as the name of the log file. Can I do this kind of date formatting in
> cron?

> Sent via Deja.com http://www.deja.com/
> Before you buy.