Hi,
I have a directory which uploads files every minute.I want to check the number of files uploaded for every one hour.
I want to run a cron every hour to chk this but iam hanged like how to write the script.
Like the script should count for one hr ie from 00:00 to 01:00 hrs then next hr when the cron is run shld chk for 01:00 to 02:00 hrs.
Can someone guide me to start writing this script.
I have added a basic script . You can modify it as per your requirement and add it to cron to execute every one hour.Let us know if you have any further querry.
lst_count=`cat last_count`
new_count=`ls /PATH | wc -l`
nofilesupload=`expr $new_count - $lst_count`
time=`date`
echo "At $time $nofilesupload new files uploaded with in last HOUR" >> logs.txt
ls /PATH | wc -l > last_count