The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
server monitor script... zedex Shell Programming and Scripting 1 06-01-2008 04:10 PM
load monitor script locabuilt UNIX for Advanced & Expert Users 7 01-19-2007 02:37 PM
Hep with script to monitor directory cmf00186 UNIX for Dummies Questions & Answers 2 10-25-2006 02:42 PM
Script to Monitor databases help with arrays nelmest Shell Programming and Scripting 1 09-05-2005 10:50 PM
User Login Monitor Script Drewser Shell Programming and Scripting 2 02-07-2005 04:45 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-15-2007
jonathan184 jonathan184 is offline
Registered User
  
 

Join Date: May 2007
Posts: 8
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 04:59 PM.. Reason: put new code that i got
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0