- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to check for file size change on list of fi...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2008 06:46 PM
тАО09-03-2008 06:46 PM
I'm looking for a shell script fragment to test files named in an inventory file to see if their size changed minute to minute over a 2 minute timeframe. Script will run from cron every 15 minutes. Basically moving oracle audit files that are done writing to a remote server. Not sure how oracle generates audit logs, but if possible, I'd also be open to checking to see if file was done writing & then moving.
eg:
1st run: creates inventory.txt with file size & name using:
ls -lrt ${AUDITDIR}|awk '{print $5,$9}'>inventory.txt
sleeps 60 sec
<
for each file listed in inventory.txt, check to see if filesize changed. If no, delete from inventory.txt, append filename into movefiles.txt.
sleep 60 again
for each file listed in inventory.txt, check to see if filesize changed. If no, delete from inventory.txt, copy filename into movefiles.txt.
delete inventory.txt.
<< at this point I'll create md5 checksums for all files in movefiles.txt and copy the checksum files & files listed to a remote server with scp. >>
Solved! Go to Solution.
- Tags:
- ls
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2008 09:24 PM
тАО09-03-2008 09:24 PM
Re: Script to check for file size change on list of files over 2 minutes
while :
do
ls -lrt ${AUDITDIR}|awk '{print $5,$9}'>inventory2.txt
diff inventory* | grep ">"
if [ $? -eq 1 ]
then
break
fi
mv inventory2.txt inventory.txt
sleep 60
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2008 11:13 PM
тАО09-03-2008 11:13 PM
Solutionif [ ! -r inventory.txt ]; then
ll -rt ${AUDITDIR} | awk 'NF >= 9 {print $5,$9}' > inventory.txt
fi
for counter in 1 2; do
sleep 60
> inventory2.txt
while read size file; do
new_size=$(ll $AUDITDIR/$file | awk '{print $5}')
if [ $new_size -eq $size ]; then
echo $file >> movefiles.txt
else
echo $file >> inventory2.txt # save
fi
done < inventory.txt
mv inventory2.txt inventory.txt
done
rm -f inventory.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2008 11:36 PM
тАО09-03-2008 11:36 PM
Re: Script to check for file size change on list of files over 2 minutes
ls -l ${AUDITDIR}|sort| awk '{print $9,$5}'>inventory2.txt
while :
do
ls -l ${AUDITDIR}|sort |awk '{print $9,$5}'>inventory2.txt
diff inventory* | grep ">"
if [ $? -eq 1 ]
then
break
fi
mv inventory2.txt inventory.txt
sleep 60
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2009 09:12 AM
тАО01-06-2009 09:12 AM
Re: Script to check for file size change on list of files over 2 minutes
# Get file list from inventory file.
var str fileList
cat inventory_file >$fileList
while ($fileList <> "")
do
# Get next file.
var str file
lex "1" $fileList >$file
accessfile $file
# The new size is now in system variable $fsize. Compare.
done
Should work in all windows versions.
Sen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2009 09:18 AM
тАО01-06-2009 09:18 AM
Re: Script to check for file size change on list of files over 2 minutes
@ Sen : Should work in all windows versions.
This forum is for HP-UX (UNIX) discussions. There is a separate Microsoft forum here:
http://forums11.itrc.hp.com/service/forums/familyhome.do?familyId=116
Regards!
...JRF...