to compare latest logfile with the current running time of the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting to compare latest logfile with the current running time of the script
# 1  
Old 04-06-2008
to compare latest logfile with the current running time of the script

how can i compare the latest log file with the current time..


consider i am running a script "a.sh" at 09:00
( function of the script a.sh is to update the database )
this script is going to create logfile if the script is sucess
in case of failure it is not going to create logfile..

my problem is if i start the script at 9:00
and the script fails .. it not going to create any entry in logfile
and during the verification the latest logfile in the log directary is
before 9.00 and verifcation(verification is carried out inside the a.sh script only after updating databse ) will say that .. it was sucessfully updated the
database(since it takes the latest log file ). but in this case it has taken a wrong logfile to verification..

i want to know that
when i run the script at 9.00 .. script should pick the logfile which as updated after 9.00 to verification and if the latest available log file is before 9.00 .. it should say it has failed..

PLEASE HELP me in this .. i want the solution urgent as my deadline is exceeding...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Display current directory for a running process for script

I'm trying to create a ksh script to do the following: 1) Ask the user what process they want to search for. 2) Have the script read the input as a variable and use it to search for the process. 3) Display the current time & date, the working directory of the process, and finally display the... (6 Replies)
Discussion started by: seekryts15
6 Replies

2. Shell Programming and Scripting

running a bash script even after logging out from the current session

HI , I have a simple script that moves files from one folder to another folder, I have already done the open-ssh server settings and the script is working fine and is able to transfer the files from one folder to another but right now I myself execute this script by using my creditianls to... (4 Replies)
Discussion started by: nks342
4 Replies

3. UNIX for Dummies Questions & Answers

How to compare current time with the input to variant?

Hi all, I have a simple script follow: ------------- #!/bin/bash echo -n " Enter the date of today: " read dateoftoday ------------- Now I want to compare the variant $dateoftoday with date of the system (now) in order to prevent user inputs the past date to $dateoftoday. I want to make... (3 Replies)
Discussion started by: axn_boy
3 Replies

4. Shell Programming and Scripting

Shell Script to compare files, check current date and count

Hello - I have written the following basic shell script to count files, compare files and look for a particular strings in a file. Problem 1: How do I define more than 1 file location? #!/bin/bash #this is a test script FILES=$(ls /home/student/bin/dir1, home/student/bin/dir2)... (0 Replies)
Discussion started by: DallasT
0 Replies

5. Shell Programming and Scripting

Compare current time to timestamp on a file

I'm trying to compare 2 dates between current time and the timestamp on a file. The date format is mmdd Both return Apr 1 but when using if statement line 11: Apr 1: command not found error is returned #!/bin/sh log="DateLog" Current_Date=`date +%b%e` Filepmdate=`ls -l /file.txt |... (1 Reply)
Discussion started by: cillmor
1 Replies

6. UNIX for Advanced & Expert Users

Check latest time where theres the word 'processed' in logfile

Hi, Im doing a project to check the latest time with the word 'processed' in a logfile. the time range is within 2 hours before the curent datetime to present. For example: Current datetime is 'October 6 2009 8:00AM' --- HKT So the time range that need to check is from 'October 6... (1 Reply)
Discussion started by: romanne
1 Replies

7. Shell Programming and Scripting

compare logfile content

Hi folks I have some logfiles like this: ./2009_08_22_14_08_entire_backup_no_1.log . . . ./2009_08_22_14_34_entire_backup_no_14.log each one contains a timestamp from "date +'%s'" now i need function which finds the logfile with the greatest number in it and returns (echos) the... (7 Replies)
Discussion started by: latenite
7 Replies

8. Shell Programming and Scripting

to write a script to compare the file size in the current directory and previous dir

hi, i am new to this site. i want to write a script to compare the file size of the files in the current dir with the files in the previous directory. the files name will be same, but the filename format will be as xyzddddyymm.txt. the files will arrive with the month end date(i want to... (5 Replies)
Discussion started by: tweety
5 Replies

9. Shell Programming and Scripting

How to compare the mtime of a file with the current time?

Hi, I wondered if we could do this with shell script? How to compare the mtime of a file with the current time and check whether its less than 24 hours. Thanks.:b: (2 Replies)
Discussion started by: Krsh
2 Replies

10. Shell Programming and Scripting

shell script to find latest date and time of the files

Hi everyone, Please help:) I have a list of 1000 different files which comes daily to the directory.Some of the files are not coming to the directory now. I need to write a shell script to find the latest date and time of the files they came to the directory. The files should be unique.... (1 Reply)
Discussion started by: karthicss
1 Replies
Login or Register to Ask a Question
time(1T)						       Tcl Built-In Commands							  time(1T)

__________________________________________________________________________________________________________________________________________________

NAME
time - Time the execution of a script SYNOPSIS
time script ?count? _________________________________________________________________ DESCRIPTION
This command will call the Tcl interpreter count times to evaluate script (or once if count isn't specified). It will then return a string of the form 503 microseconds per iteration which indicates the average amount of time required per iteration, in microseconds. Time is measured in elapsed time, not CPU time. EXAMPLE
Estimate how long it takes for a simple Tcl for loop to count to a thousand: time { for {set i 0} {$i<1000} {incr i} { # empty body } } SEE ALSO
clock(1T) KEYWORDS
script, time ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTcl | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tcl is available on http://opensolaris.org. Tcl time(1T)