files in time...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting files in time...
# 1  
Old 12-11-2011
files in time...

Everyday I receive 2 files into the above directory /giris/feed/ before 07:00AM. Now I need to write the script in such a way to check whether the files are received in time or not.
If files received in time then message "files received in time" should sent to some log file.
If not received in time(received after 7am) then "files not received in time.Please process the files manually" to the same log time


for e.g.,
Code:
$ pwd 
$ /giris/feed/
$ ls -ltr
  -rw-rw-r-- 1 fold ora 2560 Dec 8 07:00 file_108122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 8 07:00 file2_08122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 9 07:00 file1_09122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 9 07:00 file2_09122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 10 07:00 file1_10122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 10 07:00 file2_10122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 11 07:14 file1_11122011.csv
  -rw-rw-r-- 1 fold ora 2560 Dec 11 07:14 file2_11122011.csv


Till yesterday(from above list), I have received the files in time and for todays date the files received were late. So if I run the script today , since the files received were late, message should sent to log file stating "files received late"

I am trying to automate the daily monitoring process instead of going to unix terminal everyday, I want the above information in log time to check whether the files were received or not.

Request all to share your thoughts on the above?
This will help me alot....

Thanks in advance...!!

Reagards,
Giris

Last edited by Scott; 12-11-2011 at 08:34 AM.. Reason: Code tags
# 2  
Old 12-11-2011
You want to monitor only todays files?... Will the files be moved after today?...

--ahamed
# 3  
Old 12-11-2011
files in time...

Yes ahmed.
I would like to monitor only todays files. through another batch process the files will be moved to another location after 1 day.

Once the script the script at any time, I would like to know the status of files whether received in time or not.
# 4  
Old 12-11-2011
touch is good for this sort of thing:

i.e.
Code:
$ touch -t $(date '+%m%d0700') .reference
$ find . -name "file[12]*.csv" -newer .reference
./file1_11122011.csv
./file2_11122011.csv

# 5  
Old 12-11-2011
or try this...
Code:
#!/bin/bash

today="$(date '+%b %d') 07:00"
for file in $( ls -ltr * )
do
        cmp=$( awk '{print $6,$7,$8}' <<<$line )
        file=$(awk '{print $NF}' <<<$line)
        test "$today" == "$cmp" && val="File $file is on time" || val="file $file delayed!"
        echo $val | mail you@you.com
done

HTH
--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rename all files at a time

i have some bar files in a directory appp1.APP.RTP.DEV1 appp2.APP.RTP.DEV1 appp3.APP.RTP.DEV1 need to be renamed as appp1.APP.mmk.DEV1 appp2.APP.mmk.DEV1 appp3.APP.mmk.DEV1 i need to rename all files at a time. (6 Replies)
Discussion started by: saurau
6 Replies

2. Shell Programming and Scripting

Modify different files at the same time

Hi, I'm having the following problem. I have some files to modify, between a large number of files. I thought the following code aux2=`grep -l 2.2.17 *` print "$aux2" aux3=`ls -l *.ksh | wc -l` print "$aux3" while ; do print "The counter is $aux3" #Add the sed here ... (3 Replies)
Discussion started by: radicaled
3 Replies

3. Shell Programming and Scripting

files older than a certain time

I know how to find files, which are newer than a specific time. touch -t 201103300650 dummy find /path/to/files -type f -newer dummy -exec ls -l {} \; Is there a way to find files, which are older than a specific time? (2 Replies)
Discussion started by: BeefStu
2 Replies

4. UNIX for Dummies Questions & Answers

How to arrange the files according to time

hi friends, m new to unix environment.. i want to know that "how could we arrange the various files in our unix system according to time at which they are accessed, and are there are ways that we can arrange them in ascending or descending manner..." please help me out with full details...... (4 Replies)
Discussion started by: adityamitra
4 Replies

5. UNIX for Dummies Questions & Answers

Sort two files by time

I had a question about sorting two files which contain data like the following: File 1: 09:12:12 blah blah 0 blah blah 1 blah blah 2 blah blah 09:12:15 blah blah 0 blah blah 1 blah blah 2 blah blah File 2: 09:12:13 blah2 0 blah2 1 blah2 2 ... (1 Reply)
Discussion started by: rowd23
1 Replies

6. Shell Programming and Scripting

How to redirect you o/p to many files at the same time.

How to redirect your o/p to many files without using for loop. For example:- 1-echo "blablabla" > out01 OUT 2-echo "blablabla" 1>out01 1>OUT 3-echo "blablabla" 1>&out01 1>&OUT the above code does not work! in "1" only the o/p goes to out01 in "2" & "3" the o/p goes to OUT ... (4 Replies)
Discussion started by: ahmad.diab
4 Replies

7. Shell Programming and Scripting

Moving files which are generating time to time

Hi all, I always getting great response from this forum, that why i am putting again.... I am working in a company which is giving ATM support.In one of my production server a lot of files are getting generated every day. I want to move these files to another name. The file name which is... (4 Replies)
Discussion started by: Renjesh
4 Replies

8. Solaris

find files by time

I'm working on a SunOS 5.8 box and I have to search recursively in directories matching a certain pattern for files with a .log extension that have changed within the last n-minutes, and than select the least recently used file and open it for reading, preferrably with tail. Does anyone know how I... (3 Replies)
Discussion started by: rein
3 Replies

9. UNIX for Dummies Questions & Answers

One-time use files/links

Im in the process of developing a content based website in which people will be able to upload movies(which are then converted to flv format and displayed in a flash based player.) In order to protect the submitted content I would like to setup an offsite folder for the videos and create... (0 Replies)
Discussion started by: Airhead315
0 Replies

10. Shell Programming and Scripting

removing 10 files at a time

how can i remove 10 ".c" files interactively at one time? i am tring to use the rm -i command, but this command only allows me to remove all the files instead of just 10 at a time. i realise that i can list 10 results at a time by using the find and head command concurrently, but how do i use the... (2 Replies)
Discussion started by: RianTan
2 Replies
Login or Register to Ask a Question