TigrePanthera
Technical User
Experts et al,
Hello !
I feel down right stupid to ask this question but Im not sure as to where to go on this one.
Task at hand - Monitor one specific directory for .dat files and if there are more than 10 files in there then you need to send out an email saying that there are 10 files in there. Also, I cannot set up a Cron job in there and hence I need a counter driven one which goes in there for every 60 mins or so and checks to see if there are any new *.dat files and if there are more than 5 at the end of each hour, please send an email.
Here is what I have but this is no way near completion. So help me out.
regards,
Varun.
Hello !
I feel down right stupid to ask this question but Im not sure as to where to go on this one.
Task at hand - Monitor one specific directory for .dat files and if there are more than 10 files in there then you need to send out an email saying that there are 10 files in there. Also, I cannot set up a Cron job in there and hence I need a counter driven one which goes in there for every 60 mins or so and checks to see if there are any new *.dat files and if there are more than 5 at the end of each hour, please send an email.
Here is what I have but this is no way near completion. So help me out.
regards,
Varun.
Code:
#!/bin/ksh
for FOLDER in `find ./Applications/ -type d -mindepth 1 -maxdepth 1`;
do
COUNT=`ls *.dat | wc -l`
if [ "$COUNT" -gt 5 ]; then
echo "The number of files in the directory are :$CNT"
mailx -s "Need to look at this Directory" ard@test.com
fi
sleep 3600;
done