LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-17-2008, 06:06 AM   #1
ltodd2
LQ Newbie
 
Registered: Aug 2005
Posts: 28

Rep: Reputation: 0
Adding date and time to a log file


Afternoon all

Im hoping you can help me. We have a nice new oracle server and are needing to move some files around for EDI and BACS. The server runs windows but has an app called MKS toolkit installed which give unix commands. (Needed for the oracle stuff) I have had a go using dos commands in a batch file but am not getting anywhere.
What im wanting it to do is copy files from the out folder into an edi folder and then move the files from the original out to an archive. Im wanting to log what is copied and moved. They want it to run every 10mins so I would like to create one log file per day and have the time in the file before the files are copied so we can look back and see what happened at what time.
My current attempt with dos:
copy /V E:\oracle\uatcomn\admin\out\UAT_wendy\p??????.mf e:\edi\edi_out >> e:\edi\copy.log this works but just adds and adds to the file.

Using the sh shell from MKS I can run touch `date ++%Y_%m_%d`_test.log
It's just putting it all together that im having issues with.
would like one log file per day and in each one to have a record of what was copied but with the time.

This is probably very simple but its beating me. Can anyone help please.


Thanks

Lee
 
Old 12-17-2008, 06:41 AM   #2
infernal211283_
LQ Newbie
 
Registered: Dec 2008
Posts: 6

Rep: Reputation: 0
man date:
"date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]"
 
Old 12-17-2008, 10:05 AM   #3
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
What are you having trouble with? date can also be used to get the current time, and it looks like you know how to append the output of cp -v to a file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding date and time to Squid access.log jonette20 Linux - General 5 09-21-2009 07:41 AM
how to add date n time in proxy access.log sunlinux Linux - Networking 3 08-23-2007 06:54 AM
Log File Date Oddness iamryman Linux - Server 1 05-22-2007 01:39 AM
Date in Log file name Runningonair Linux - General 8 06-02-2006 09:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration