How to find the any log which is not updated since particular date?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to find the any log which is not updated since particular date?
# 1  
Old 03-28-2014
How to find the any log which is not updated since particular date?

Hello,

Iam running with one issue, since particular date looks like one of the script vanished from the system after restarting of the system.
I dont know which scrit it was but definatelt there should be one.
but might be some logs would be there which have not updated from that day.

so here i my query how i find a particular log which is not updated from that day means consider 03rd nov 2013.

so log may be updated on 03rd nov 2013 but after system restartbut 4th onwards that scripts log not have been updated...

any command to find that log which is not updated from 04th nov but it was updated til 03rd nov.
# 2  
Old 03-28-2014
Create a file with Nov 4th, 00:00:00 timestamp and check all .log files if they are updated later.

Code:
touch -t 201311040000.00 reference_file
for i in *.log
do
if [[ ! ${i} -nt reference_file ]]; then
echo ${i}
fi
done


Last edited by SriniShoo; 03-28-2014 at 01:57 AM.. Reason: code correction
# 3  
Old 03-28-2014
Here is another way to do what SriniShoo suggested that doesn't depend on all of the log files being in a single directory. Assuming you know the root directories under which your log files are stored and that your log files have filenames ending in .log, you could try something like:
Code:
#!/bin/ksh
IAm=${0##*/}
ref_file="$IAm.$$"
trap 'rm -f "$ref_file"' EXIT
touch -t201311050000 "$ref_file"
find /list/of/directories/containing/logfiles ! -newer "$ref_file" -name '*.log'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

AIX idea needed to check the logs updated date and time

Hi with the help of Gabriel canepa, i have just edited filename only in his code. The help which i got and he helped is 1) I have around 22 logs and each log should be updated in the last 24 hours from the current timestamp. 2) It should check for ERROR message (not error,Error) in the log and... (2 Replies)
Discussion started by: Kalaihari
2 Replies

2. Shell Programming and Scripting

Log search and mail it if the log is updated before 24 hours from the current time

Hi , We have around 22 logs , each has different entries. I have to automate this using shell script. The ideas which am sharing is given below 1) We use only TAIL -100 <location and name of the log> Command to check the logs. 2) We want to check whether the log was updated before 24... (13 Replies)
Discussion started by: Kalaihari
13 Replies

3. Shell Programming and Scripting

Find out whether directory has been updated with files in the last 5 minutes or not

Hi, I am trying to work on this script that needs to monitor a Directory. In case there are no files received in that Directory for the last 5 minutes, it has to send out an alert. Could someone please suggest any approach for the same. Note: I did check out various previous psts -... (8 Replies)
Discussion started by: rituparna_gupta
8 Replies

4. Shell Programming and Scripting

How to find last updated date and time of a folder in Perl?

Hi All, I have a process which after some time continues move a files to some folder(say the name of the folder is logdir) What i am trying to do is as the files are coming to the logdir folder, I want the latest updated time and date of the folder in PERL. (1 Reply)
Discussion started by: parthmittal2007
1 Replies

5. Shell Programming and Scripting

Find last updated files and rename

HI I have a requirement to find the last updated files from a directory whcih has subdirectories and inside them we have files with .txt,.doc,.xls .. extensions. i have to find those files which were updated in the last 1hr and rename the files with respective <sub-directory>_<filename> and copy... (3 Replies)
Discussion started by: ramse8pc
3 Replies

6. Shell Programming and Scripting

to find the last updated file from different groups of files.

Hi i have many sets of files as shown below(here i have shown 2 sets) basel_aa_20091030.txt basel_aa_20091130.txt basel_aa_20091230.txt basel_bb_20091030.txt basel_bb_20091130.txt basel_bb_20091230.txt from each set of files i need to select the latest updated file(there are... (3 Replies)
Discussion started by: jagadeeshn04
3 Replies

7. Shell Programming and Scripting

how to make a log.txt and add date and time when use ls,touch and find

Hey guy, how to make the log.txt file and record date and time when ls, touch and find command run? Thanks Boly (13 Replies)
Discussion started by: chenboly
13 Replies

8. Shell Programming and Scripting

find recently modified/ updated file

hi gurus, i would like to know how can i find logs files which were recently modified or updated? :confused: using this command? find . -name "*.log" -mtime ?? so what should i put for mtime? thanks. wee (9 Replies)
Discussion started by: lweegp
9 Replies

9. Shell Programming and Scripting

Find recently updated files in home directory

Is there a shell command that will allow me to list index files in the /home directory for all users on a server that have been updated within the past 24 hours? (e.g. index.htm .html .php in/home/user1/public_html /home/user2/public_html /home/user3/public_html etc ) (2 Replies)
Discussion started by: Kain
2 Replies

10. UNIX for Dummies Questions & Answers

Find last updated file

Hi all, my problem is teh following: I need to move a file from a folder to another and I usually do it by the get command but in this case I have a list of file in the source folder and I have to select only the lust updated one. Ho to do this? All the files have the same name followed... (4 Replies)
Discussion started by: callimaco0082
4 Replies
Login or Register to Ask a Question