file old than 10 mins to alert


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file old than 10 mins to alert
# 1  
Old 06-02-2010
file old than 10 mins to alert

Hello

We have to monitor a FTP utility where we have to monitor for checking presence of a file in directory With max time allowed for a file to stay in the directory on FTP client server as 10 mins.
The only way we are going to be able to do what we are lookign for is to write a script to determine whether or not there are any files in the specified directory that are > 10 minutes old and return a status of something like :"true" for files found or "false" for no files found. Have the script write/update that status to a log, say ftp-files-over-10-minutes.txt,

can you please share such a script

Thanks,
Viv
# 2  
Old 06-02-2010
Hi,
I can see a few possibilities. But time-to-live will always be subject to how often You check. You can have a script running that constantly checks for files of a certain "age" and take action upon them, such as logging, deleting, etc. You will have to have a loop and the tighter (the shorter sleep You have) will put a higher load on the system. Or You can rely on a cron utility to schedule such a script to run every minute or so, and You may have to keep track of "previous time" and "current time" between runs, etc.

But if You have the option of installing extra software and Your kernel supports the inotify subsystem, You should definitely have a look into the inotify-tools or incron. Those tools will allow You to "put a watch" on file events, for example specific files or directories, and take action upon that event. That could for example be starting a script (with the file as an argument) log its creation, sleep for 10 minutes, delete it, log its deletion and then exit.
How does that sound?

Best regards,
Lakris
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Cybersecurity

**ALERT**ALERT* Whats app requesting users to upgrade to latest version as; its vulnerability found.

Hello All, Want to share here an article for Whats app users that team whats app is requesting users to upgrade to its latest version since they have found a vulnerability; where Hacker could turn on a cell's camera, mic and scan messages and emails. Here is an article from "THE VERGE" for... (1 Reply)
Discussion started by: RavinderSingh13
1 Replies

2. Shell Programming and Scripting

Script to find directory is getting files in every 10 mins, if not then when last time file received

Dears, I am looking for a script which will work as a watch directory. I ha directory which keep getting files in every 10 mins and some time delay. I want to monitor if the directory getting the files in every 10 mins if not captured the last received file time and calculate the delay. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

3. Shell Programming and Scripting

Need logs 5 mins old

I need 5 mins old logs to be dumped into a a new file. The date formats in the two log files are Can you suggect for both formats ? bash-3.2$ uname -a SunOS myserver 5.10 Generic_150400-26 sun4v sparc sun4v ---------- Post updated 05-04-16 at 12:24 AM ---------- Previous update was... (2 Replies)
Discussion started by: mohtashims
2 Replies

4. UNIX for Dummies Questions & Answers

Script to search log file for last 15 mins data

Hi All, I have an issue which I'm trying to understand a way of doing, I have several nodes which contain syslog events which I want to force trigger an email initially (eventually leading to another method of alerting but to start with an email). Basically the syslog file will have hours worth... (6 Replies)
Discussion started by: mutley2202
6 Replies

5. Shell Programming and Scripting

How to check if there is a file in the last 10 mins?

I have a script that runs every hour from the crontab (see the settings of the crontab below) (15 mins past the hour) 15 * * * * /home/usr/usr1/ProvAll This script saves two files in the following format now=`/bin/date '+%Y%m%d.%H%M%S'` file1.$now (for example) file1.20140722.031502... (12 Replies)
Discussion started by: knijjar
12 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Check for a file and keep waiting for 30 mins

Hi All! I want to have a shell script that checks for a file in a particular folder and then if the file is not found it should wait for 30 minutes. Again check for the file, if it FOUND then successfuly exit the shell script stating the file is found. Else it should continue to wait. ... (4 Replies)
Discussion started by: akshay01987
4 Replies

7. Shell Programming and Scripting

tail for 15 mins

Hi, I want to write a script which will tail a particular file for 15 mins and then sleep for 10 mins and again tail for 15 mins. This cycle will go on for a limited period of time. How can i ensure that tail command will run for 15 mins before calling sleep command Thanks (6 Replies)
Discussion started by: @bhi
6 Replies

8. AIX

Grep last 5 mins from log file in AIX

I want to grep only last 5 mins of a log file in bash I have a syslog which contains the following Mon Jul 11 20:47:42 Mon Jul 11 20:47:52 The following works in Unix but not in AIX . Please can you let me know as to what would be the AIX equivalent Code: for (( i = 5; i >=0;... (1 Reply)
Discussion started by: necro98
1 Replies

9. Shell Programming and Scripting

Retrieve logs generated in last 10 mins from a log file using 'grep' command

HI All, I have a log file where the logs will be in the format as given below: 2011-05-25 02:32:51 INFO PROCESS STARTING 2011-05-25 02:32:52 INFO PROCESS STARTED . . . I want to retrieve only the logs which are less than 5 mins older than current time using grep... (3 Replies)
Discussion started by: rvhg16
3 Replies

10. Shell Programming and Scripting

Script which will search for a file for 15 mins

Hi All, I would like to write a script which will search a file say abc.dat in /a/b/data for 15 mins only. If the script finds the file in 15 mins then it will exit will exit sucessfully and if there is no file for 15 mins it will exit and copy the last day file (abc.dat_ddmmyyhhmmss) from... (1 Reply)
Discussion started by: chandancsc
1 Replies
Login or Register to Ask a Question