Sponsored Content
Top Forums Shell Programming and Scripting awk to monitor size in directory Post 302912610 by SkySmart on Sunday 10th of August 2014 08:52:02 PM
Old 08-10-2014
worked perfectly. thanks guys!

one last question on this:

Code:
find /var/log -name "*.test*" -exec du -m {} \;

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:

Code:
find /var/log -name "*.test*" -exec du -m {} \; -exec perl -le "print ((stat '${eachFile}')[9])"

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.

what im currently doing is:

Code:
warning=`find /var/log -name "*test.log*" -size +20000c -amin -1440 -exec du -m {} \; 2>/dev/null`
critical=`find /var/log -name "*test.log*" -size +60000c -amin -1440 -exec du -m {} \; 2>/dev/null`

any ideas?

Last edited by SkySmart; 08-10-2014 at 10:32 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

monitor jvm heap size

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)
Discussion started by: rein
0 Replies

2. Shell Programming and Scripting

script to monitor directory

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)
Discussion started by: nulinux
17 Replies

3. Shell Programming and Scripting

monitor size of file in realtime

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)
Discussion started by: hazno
7 Replies

4. AIX

monitor directory events

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)
Discussion started by: pbillast
2 Replies

5. Solaris

Directory size larger than file system size?

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)
Discussion started by: sparcman
6 Replies

6. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

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)
Discussion started by: shaal89
0 Replies

7. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

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)
Discussion started by: MAKHAN
4 Replies

8. Shell Programming and Scripting

Script to monitor directory size of specific users

Hi, i am new to shell scripts, i need to write a script that can monitor size of directory of specific users. Please help. Thanks, Nitin (2 Replies)
Discussion started by: nicksrulz
2 Replies

9. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

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)
Discussion started by: jmgibby
2 Replies
gvfs-monitor-file(1)						   User Commands					      gvfs-monitor-file(1)

NAME
gvfs-monitor-file - monitor the change of a file using the VFS system SYNOPSIS
gvfs-monitor-file URI DESCRIPTION
gvfs-monitor-file monitors the change of a file using the VFS system. OPERANDS
The following operands are supported: URI Specifies the file location in standard URI format. EXAMPLES
Example 1: Monitor a local file example% gvfs-monitor-file file:///tmp/example ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gvfs-monitor-file Executable to monitor the change of a file using the VFS system. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-gvfs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gvfs-copy(1), gvfs-info(1), gvfs-less(1), gvfs-ls(1), gvfs-mkdir(1) gvfs-monitor-dir(1), gvfs-cat(1), gvfs-mount(1), gvfs-move(1), gvfs- rename(1), gvfs-open(1), gvfs-rm(1), gvfs-save(1), gvfs-trash(1), gvfs-tree(1), attributes(5), environ(5) NOTES
Written by Alvaro Lopez Ortega, Sun Microsystems Inc., 2008. SunOS 5.11 25 Mar 2008 gvfs-monitor-file(1)
All times are GMT -4. The time now is 10:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy