Creating log file with today's date (newbie alert!)

Creating log file with today's date (newbie alert!)

Post by Johan Erla » Thu, 08 Aug 1996 04:00:00



I'd like to know how I can redirect the output of a program (eg. backup) to a
log file using today's date. eg. LG960807.LOG as log file name.

Please email your replies to me, and I'll summarize it for other newbies.

Rgds,

Johan E.

-----------------------------------------------------------------------

|| MIS Dept.       |+27+12 333-6021  |                               ||
|| SAMES (Pty) Ltd |   012 333-6021  |                               ||
-----------------------------------------------------------------------

 
 
 

Creating log file with today's date (newbie alert!)

Post by Dave Plon » Thu, 08 Aug 1996 04:00:00



> I'd like to know how I can redirect the output of a program (eg. backup) to a
> log file using today's date. eg. LG960807.LOG as log file name.

Here's my answer from my company's FAQ:

   How can I create a Unix file with the current date/time in its name?

      Say, for instance, that you were running a given command, and wanted
      its output to go to a log file that had the date in the file name in
      YY_MM_DD format. (You might want to do this so that the file will
      not be overwritten on a subsequent day when the command gets
      restarted.) The date command has options allowing you to specify the
      format of its output:

      nohup command >command.log.$(date +%y_%m_%d) &

      Remember that you may want to specify the time down to the second if
      you want to nearly eliminate the possibility of ever overwriting a log
      file. (Another option would be to put the date and a sequence number in
      the log file name.)

      See the date man page for details on other format specifiers.

Dave

--


 
 
 

1. List of files with today's date

Hello,

        I am totally new to shell programming.
I am trying to write a script to scan a
directory for all files that have today's
date (will need to run this script everyday)
and then file transfer them to the PC.

First of all, how do I get a list of all
files with today's date?
ls -l | grep "$x"
where $x is today's date gives me
a complete listing. How do I get only
the file names from that?
Any suggestions are appreciated.

Thanks,
Jyothi

2. How to install Linux on more than two hard disk??

3. Help : Check if today's date is in a file

4. Linux on AMD486DX2-66?

5. How to Delete files based on (today's date - 3 days) ??

6. crypt() - where to find key for passwords?

7. ksh...newbie alert..newbie alert

8. z-modem-protokoll

9. Today is 'date'

10. Create a script to make a folder with todays date

11. Today's KLEZ Alert

12. Global Date Change (Newbie Alert)

13. mail a subject with today's date