- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Testing filesize in posix
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
Forums
Discussions
Discussions
Discussions
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
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
05-01-2002 04:30 AM
05-01-2002 04:30 AM
An interesting problem I have run into. I will give you a general overview so as not to bore anyone.
I receive files via ftp all day long. Upon receipt I must then send them out via dialup. The last step of automating the process is an apparently simple script that simply waits for the file size to stablize and remain constant for a certain period of time to avoid sending out partial files.
I am certain I am not the only person who has run across this problem. Suggestions anyone?
jiin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:35 AM
05-01-2002 04:35 AM
Re: Testing filesize in posix
You could use fuser or lsof to see if the file was in use.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:36 AM
05-01-2002 04:36 AM
Re: Testing filesize in posix
You could use 'wc -c' to assay the size of the file in characters. Capture the value; sleep for a short period; retest; and if the value is the same, consider the process done; otherwise repeat the loop.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:41 AM
05-01-2002 04:41 AM
Re: Testing filesize in posix
'fuser' works, you can code it thus:-
if [[ -n $(fuser
then
fi
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:41 AM
05-01-2002 04:41 AM
Re: Testing filesize in posix
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:43 AM
05-01-2002 04:43 AM
SolutionFor POSIX shell documentation on checking filesizes use:
man sh-posix
and use "lsof filename" to see if anyone has it open!
*************************
If you recieve these files from some automated process have that process modified to do this (I've been doing this for over 10 years now without any issues):
Data file is received, with some conventional naming like
Here is an example:
Sender sends the file banktrans_20020501.dat
when it is done, the sender sends a blank file, or even with some useful info in it:
banktrans_20020501.rdy
The receiver ONLY looks for files that match "*\.rdy" to be processed.
Saves everyone a lot of headaches!!!
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 04:54 AM
05-01-2002 04:54 AM
Re: Testing filesize in posix
put
rename
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 05:06 AM
05-01-2002 05:06 AM
Re: Testing filesize in posix
Rather than looking at filesize a better way is to see if the file has been modified in some period of time. The attached perl script will do the trick:
SECONDS=60
FILENAME=myfile.dat
fileage.pl -m -s ${SECONDS} ${FILENAME}
STAT=$?
if [ ${STAT} -eq 0 ]
then
echo "${FILENAME} has not been modified in"
echo "the last ${SECONDS} seconds."
echo "It is safe to copy."
else
echo "${FILENAME} is not safe to copy."
fi
The script silently report whether or not a file has been modified. fileage.pl -u gives full usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2002 10:22 AM
05-01-2002 10:22 AM
Re: Testing filesize in posix
Normally LSOF would have been one of my first thoughts, however 11i doesn't always like to compile the 11.00 depot applications and this is the case with LSOF.
Thanks a million for all the help.
jiin