Modified in last 2 days


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Modified in last 2 days
# 1  
Old 06-01-2009
Modified in last 2 days

I have application log files as below . let say Archiver6 is one app and it has log file as

Archiver6.log
Archiver6.log.1
Archiver6.log.2
Archiver6.log.3


What i want is whether these log files are not modified in last 2 days for which i am using the below command
Code:
find . -mtime +2 -name "Archiver6.log*" -print

See here is the help i need. When i use the command it display those filename of Archiver6 having no entry for past 2 days. But what i want is if entry is found in any of Archiver6 files then it should not display.like

Archiver6.log has entry for past 2 days
Archiver6.log.3 has no entry for past 2 days

What happens is that you will always find the latest date entry in archiver6.log and when the files reaches certain size it pushes it content to .log1 and then log.2



Below is the script in which i have to use this logic.

Code:
#!/bin/ksh

rm -rf /ednpdtu7/u01/pipe/AMIS_Scripts/logs_entry_check.txt

cd /ednpdtu7/u01/pipe/logs
for i in EstimatedUFBReadCountAdapter1.log EstimatedUFBReadCountAdapter2.log EstimatedUFBReadCountAdapter3.log EstimatedUFBReadCountAdapter4.log EstimatedUFBReadCountAdapter5.log EstimatedUFBReadCountAdapter6.log Archiver8.log Archiver6.log Extrapolation.log AMRFlags.log ReadsUsedForBilling.log UFB.Start.log CyclesSynchronization.log UFBInterpolation.log UFBInterpolationNotification.log Cleaner3.log EventsAdapter.log EventsCleaner.log UFBEstimatedReadsMonitor.log SummaryHandler.log ChannelUsage.log WMSAdapter.log EstimatedUFBReadMQAdapter.log 
do
count=0
count=`find . -mtime +2 -name "$i" | wc -l`

if [ $count -gt 0 ]
then
find . -mtime +2 -name "$i" -print
find . -mtime +2 -name "$i" | sed "s/\.log//" >> /ednpdtu7/u01/pipe/AMIS_Scripts/logs_entry_check.txt
fi

done


Last edited by ali560045; 06-01-2009 at 03:22 AM..
# 2  
Old 06-01-2009
did u try something like this ?..
Code:
find . ! -mtime +2 -name "Archiver6.log*" -exec {} echo has no entry for past 2 days  \;

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find a file that's modified more than 2 days ago but less than 5 days ago?

How to find a file that's modified more than 2 days ago but was modified less than 5 days ago by use of any Linux utility ? (4 Replies)
Discussion started by: abdulbadii
4 Replies

2. Shell Programming and Scripting

Script to check for the file existence, if file exists it should echo the no of modified days

Hi, I am looking for a shell script with the following. 1. It should check whether a particular file exists in a location #!/bin/sh if ; then echo "xxx.txt File Exists" else echo "File Not Found" fi 2. If file exists, it should check for the modified date and run a command... (2 Replies)
Discussion started by: karthikeyan_mac
2 Replies

3. Shell Programming and Scripting

Find the directory modified/created before 4 days

Hi, I have an application which creates some directories while running. I want to delete these directories which are 4 days older. i tried find . type d -mtime +1 -print And it is working fine.. but find . type d -mtime +4 -print is not giving any results which are 4 days... (6 Replies)
Discussion started by: Tuxidow
6 Replies

4. Solaris

List of files last modified 30/60/90 days

Hi, I want to find the list of all the files under a directory (including it's subdirectories) last modified 30 days, 60 days, 90 days..also I want to find out the rate at which the disk space is growing. Please help. (3 Replies)
Discussion started by: b.paramanatti
3 Replies

5. Shell Programming and Scripting

How to get a filename modified by attaching modified timestamp

Hi, I want to modify a filename in AIX by attaching the last modified timestamp. I want the timestamp completely in numerical format (eg:200905081210. yr-2009, mnth - 05, date -08, hr - 12, mins - 10). For example if the filename is a.log and it was modified on April 6th 2008 at 21.00. I... (16 Replies)
Discussion started by: Ruks
16 Replies

6. Shell Programming and Scripting

How many days since a file was modified?

I am trying to write a script to backup my laptop to a NAS drive using rsync. I want the backup to be done, only if it has been more than a week since my last backup. Each time the rsync command executes, I also create a file backuptime.txt file, with the time at which the script completed the... (1 Reply)
Discussion started by: anandjayaraman
1 Replies

7. UNIX for Dummies Questions & Answers

how to retrieve original contents of a modified file (modified using vi)

Made changes to a file using vi editor and saved those changes now realised that the changes are not required How can I get the previous version of the file.i.e the one which was there on which I had made changes (3 Replies)
Discussion started by: novice100
3 Replies

8. Shell Programming and Scripting

ls latest 4 days or specify days of files in the directory

Hi, I would like to list latest 2 days, 3 days or 4 days,etc of files in the directory... how? is it using ls? (3 Replies)
Discussion started by: happyv
3 Replies

9. UNIX for Dummies Questions & Answers

list last 10 days modified files

All, Is there is anyother single command that will handle ls -lrt | tail -10 Please let me know Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

10. Shell Programming and Scripting

How to zip a modified file 15 days before but not scanning my sub directory files

I am using zip -m option to zip my files, but i dont want my sub directories files to be zipped (1 Reply)
Discussion started by: skrish70
1 Replies
Login or Register to Ask a Question