Operating System - HP-UX
1847335 Members
2361 Online
110264 Solutions
New Discussion

log file generation problems

 
SOLVED
Go to solution
u856100
Frequent Advisor

log file generation problems

people,

I have written a script that I am referencing via cron.

The cron entry is as follows :
46 13 * * 1 /interfaces/EMP/LV/out/loadftpextract.sh test* /app/ffe/ffeprod/bulkload > loadftpextract.log.$(date +%d%m%Y)

The script works fine, the only thing that I am having problems with is the redirect file at the end of the command line. The log file is not being created with a date suffix, All I am getting is loadftpextract.log. each time.

Running :

loadftpextract.sh test* /app/ffe/ffeprod/bulkload > loadftpextract.log.$(date +%d%m%Y)

manually at the command line works fine, and generates the log correctly.

the only thing I have tried is changing the shell reference at the start of the script from posix to korn, but no luck

any ideas?

many thanks in advance
John
chicken or egg first?
6 REPLIES 6
Robert-Jan Goossens
Honored Contributor

Re: log file generation problems

Hi John,

Try it with quotes,

46 13 * * 1 /interfaces/EMP/LV/out/loadftpextract.sh test* /app/ffe/ffeprod/bulkload > "/path/loadftpextract.log.$(date +%d%m%Y)"

Hope thsi helps,
Robert-Jan

Nicolas Dumeige
Esteemed Contributor

Re: log file generation problems

The pourcentage caractere "%" has special meaning in crontab.
All different, all Unix
u856100
Frequent Advisor

Re: log file generation problems

good idea!!!

no luck unfortunately

thanks for the reply!
cheers
John
chicken or egg first?
Robert-Jan Goossens
Honored Contributor

Re: log file generation problems

Hi Again,

cron can't find date command.

46 13 * * 1 /interfaces/EMP/LV/out/loadftpextract.sh test* /app/ffe/ffeprod/bulkload > "/path/loadftpextract.log.$(/usr/bin/date +%d%m%Y)"

Robert-Jan
Sanjay Kumar Suri
Honored Contributor
Solution

Re: log file generation problems

Following worked:

57 18 * * * /var/home/sks/junk1>"/var/home/sks/load.log.`date +\%d\%m\%Y`"
59 18 * * * /var/home/sks/junk1>/var/home/sks/load.log.$(date +\%d\%m\%Y)

Need to escape % sign.

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
u856100
Frequent Advisor

Re: log file generation problems

thanks a lot people, got there in the end

much appreciated!!!!

thanks for taking the time

John
chicken or egg first?