i'm trying to find the most efficient way to monitor specific files in different directories in one go.
each one of these directories can have subdirectories which need to be looked into as well.
I want to find any file in this directory that has the name ".gmei" in its filename, and check if the size of the file is at least 9000MB. if it is, spit out the file names.
my initial approach to this was something like this:
the problem is i'm almost certain this method wont be efficient.
is there any other way to accomplish this quickly?
Your specification of 9000Mb is strange. Assuming that you mean 9Gb (as in 9*1024**3 bytes), try:
If the version of find on your system doesn't accept -size +9G, try changing it to -size +9663676416c.
If you meant files with sizes greater than 9,000,000,000 bytes, try:
This User Gave Thanks to Don Cragun For This Post:
how do i add a second command to the above so it also includes the number of seconds ago that each file was last modified?
something like:
Another issue i'm having is, i need to catch files that breach the warning and critical thresholds by issuing only one find command. currently, im running two separate find sessions, one for warning, the other for critical. i'd like to be able to combine them into one.
You'll need to write a script that accepts filenames and deals with them as you require:
Then just call the script from your find command for all files over the warn size, the script can then decide if the file is a warning or a critical and deal as appropriate.
You don't mention your OS so I can't get too specific on how the script will check times and sizes on your OS.
However, on many linux systems you can use something like this:
the OS i'm going to be using this on is AIX (5.2) and Linux.
things work fine on linux, but aix is proving to be quite challenging.
the /tmp runs deep with several subdirectories. as a result, the above command can take a long time to complete. which is why i want to be as specific as i can as to the type of file i want find to look for.
can anyone suggest a better idea? what i want to do is find all files that under 12 hours old.
I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms.
Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
Hi All,
I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command .
We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Hi,
We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB?
I have seen this before we an Oracle temp file... (6 Replies)
I'm am looking for a cheap way to trigger a script when a new file is written in a specific directory. AIX 5.3. It is a production system, so no kernel patching (i.e. inotify).
Filemon and audtiing are too expensive.
Thanks in advance. (2 Replies)
How would one monitor the size of a file in realtime, then when it reaches a certain size (like 10megs), gzip, append timestamp to filename and scp to another box?
regards (7 Replies)
What is the best way for a script to run to monitor a directory for the presence of files and then perform a function afterwords? I was hoping to have it continually run and sleep until it detects that files are present in the directory, then break out of the loop and go on to the next step.
... (17 Replies)
I'm running websphere 4.5 on AIX 5 with java 1.3 and would like to find out the following: How much memory is allocated to each JVM, and how much of the allocated heap size is actually being used by a specific JVM? (0 Replies)