need help doing a script to monitor if files are go through


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting need help doing a script to monitor if files are go through
# 1  
Old 05-15-2007
need help doing a script to monitor if files are go through

I am trying to do a shell script to check a folder and see if files are passing through.

Now if a file did not pass through in the last 1 hour send an email.


ftp----------> folder to monitor ----------->ftp

Now the script that moves the file runs every sec in cron, so i do not know if i could list it to get the info. Should i write to a file?
This is what i came up with so far


Code:
#Set the path to the folder to monitor
SUBJECT="DWH FILES WERE NOT SENT IN THE LAST HOUR"
FILE1="/home/tibco/javastuff/test/dwh*"


cd /home/tibco/javastuff/test/

###### Run list command
ls -l
time=`echo $line | awk '{ split($8,a,":"); print (a[1]*60)+a[2] }'`
FILEMATCH=`echo $line | awk '{ print $9 }'`


if [ $FILE1 = $FILEMATCH ]
  then
     echo "$time" > dwhtime.txt

     else
echo running else statement
######## Run date command ##########
date
  time2=`echo $line | awk '{ split($4,a,":"); print (a[1]*60)+a[2] }'`
        if [ $time2 -gt $time ]
           then
           mail -s "$SUBJECT" testemail <<EOF
          $SUBJECT
          $time
EOF
        fi

fi

I am not sure whatt to do from here?

Could somebody help me out please.

Last edited by jonathan184; 05-15-2007 at 05:59 PM.. Reason: put new code that i got
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script monitor website wth default tomcat script

Hi all, on our application server we have the following script that monitor the status of the website, my problem here is that i have edite the retries from 3 to 5, and the timewait to 120 second, so the script should check 5 times every 2 minutes, and if the fifth check fails it must restart... (0 Replies)
Discussion started by: charli1
0 Replies

2. Shell Programming and Scripting

Script to monitor the changes on files

Hello all, I'm planning to write a script to monitor the changes on configuration files on my application server, i have around 50 properties files which really crucial for the application to perform well but we have a challenge here is that all the application team (development, testing and... (2 Replies)
Discussion started by: Mahesh_RPM
2 Replies

3. Homework & Coursework Questions

Need shell script to monitor files

Hi Experts, I am not good in writing script. Just stared. I am looking for shell script to check following parameters. 1) Number of files on remote Linux SUSE server.- Any directory and sub directory. 2) I should define number of files in script. Files should be variable. 3) Age of the... (2 Replies)
Discussion started by: ApmPerfMonitor
2 Replies

4. Homework & Coursework Questions

shell script that can create, monitor the log files and report the issues for matching pattern

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write an automated shell program(s) that can create, monitor the log files and report the issues for matching... (0 Replies)
Discussion started by: itian2010
0 Replies

5. Shell Programming and Scripting

Shell Script to monitor folder and upload found files via FTP

Hi everyone! I'm in a need of a shell script that search for all files in a folder, move all those files to a temp folder, and upload those files via FTP. When the file transfer via FTP completes successfully, the file is moved to a completed folder. In case any of those files fails, the file... (4 Replies)
Discussion started by: pulsorock
4 Replies

6. UNIX for Advanced & Expert Users

Monitor files being copied/accessed

Hello, Is there a way (without 3rd party software) to know if a file has been accessed and/or copied ? I'm interested in any solution : doing command line instructions , running background scripts etc... I apologize if I posted this in the wrong forum. Thank you! (8 Replies)
Discussion started by: prostiiinet
8 Replies

7. Shell Programming and Scripting

monitor log files

Hello, I want something like this tail -f /a/b/c/*.log | grep -i "STRING1|STRING2 " > a.txt I want to check all the log files in a particular directory then grep if any of the log files have "STRING1" and "STRING2" string and then have to send email to the group. Platform is HP-UX it... (8 Replies)
Discussion started by: RTY
8 Replies

8. UNIX for Dummies Questions & Answers

Monitor files

I have just started UNIX administration..I want to monitor files with a specific extensions.. ie, I want to monitor .doc or .DOC files created in particular directory..The script should display (every minute) a list of those filenames created after the previous display. (1 Reply)
Discussion started by: aadi_uni
1 Replies

9. UNIX for Dummies Questions & Answers

Help: script to monitor incoming files

I have 20 or so files that are ftp'd each day to a particular directory. I want to create a script that will tell me if any of these files fails to arrive or if any additional files arrive. I'm thinking I'd have a list of file names that should arrive each day, and the script would check each days... (2 Replies)
Discussion started by: daveyc82
2 Replies

10. Shell Programming and Scripting

script to monitor files in a directory and sending the alert

Hi All, We are having important config files in an directory which was accessable by all /auto/config/Testbed/>ls config1.intial config2.intial config3.inital often we find that some of the lines are missing in config files, we doubt if some one is removing. I would like to write... (0 Replies)
Discussion started by: shellscripter
0 Replies
Login or Register to Ask a Question