Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to copy a binary file while the file is being written to by another process Post 302603953 by Corona688 on Friday 2nd of March 2012 11:10:07 AM
Old 03-02-2012
Reading from a file doesn't disturb anything, at all. The writer doesn't know or care anything else is reading, and the data being written or position it's being written to won't be upset, reset, or altered.

The real worry would be whether you'd get anything sensible by doing so. You could catch the data file in an in-between or invalid state -- a half-written line or some such -- except you've handily told us your application appends, so that earlier records won't be altered; and does so in individual 512-byte blocks.

If your application writes 512 bytes at a time, i.e. one write of 512 bytes instead of 512 writes of 1 byte, you'll never catch the file in a halfway state -- from a user perspective, the file will grow cleanly in 512-byte jumps.

In short, it ought to be safe to simply copy this file. You don't even need to stop the application.

Last edited by Corona688; 03-02-2012 at 12:25 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

File being used/written

Hello, Which command in unix can tell whether a file is being used/written by another process. e.g. If one process is copying a very big file in some directory and there is another cronjob process which checks for a new file and in this directory and process the file. I want to check, if the... (4 Replies)
Discussion started by: sanjay92
4 Replies

2. Shell Programming and Scripting

Checking a file is not being written to

Hello All I am attempting to write a shell script (bourne shell script) which will copy a tar'd and compressed file from a directory to a staging area but will not know whether the file is still open for write since files are being ftp's to my site at random times during the day. Once I am... (14 Replies)
Discussion started by: kanejm
14 Replies

3. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies

4. Shell Programming and Scripting

Ensure file copy is complete before starting process

Hi experts, I have a requirement wherein a user is uploading a file to the Landing directory on one of our Linux servers. A cron job is scheduled to run after every 5 minutes which will pick up the files from the source (Landing) dir and copy to the target dir, and once successfully copied to... (4 Replies)
Discussion started by: adi_2_chaos
4 Replies

5. Shell Programming and Scripting

check if some file is in copy process, then transfer it

my user copy large files, and it's take 10min for file to be copied to the server (/tmp/user/ files/), if in the meantime start my scheduled script, then it will copy a part of some file to server1 my idea is to check the file size twice in a short period (1-2 seconds) of time, then compare, if... (5 Replies)
Discussion started by: waso
5 Replies

6. UNIX for Dummies Questions & Answers

12. If an ‘88’ Record with BAI Code ‘902’ was found on input file and not written to Output file, re

This is my input file like this 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/ 49,+00000000000416920,00002/ 03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/ 88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/ 88,902,+0000000079077,,/... (0 Replies)
Discussion started by: sgoud
0 Replies

7. Shell Programming and Scripting

Notification as popups when a file being written

I would like to know Is it possible to get a notification as pop-up in linux when a folder with extension '.aqs' written a popup should come as " The folder has been written " Thank you in advance (5 Replies)
Discussion started by: bal_nair
5 Replies

8. Shell Programming and Scripting

Fiding file except file name written in another file

HI All, Actually i have file xxx.txt where entry is like as follow. prepaid_123.txt prepaid_134.txt prepaid_156.txt So my problem is i want to find all fille except these three file in current directly of same format prepaid_xxx.txt Can you please help Thanks in Adcance (7 Replies)
Discussion started by: sujit_kashyap
7 Replies

9. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

10. Shell Programming and Scripting

Shell script to copy a file from one server to anther server and execute the binary

Hi , Is there any script to copy a files (weblogic bianary + silent.xml ) from one server (linux) to another servers and then execute the copy file. We want to copy a file on multiple servers and run the installation. Thanks (1 Reply)
Discussion started by: Nawrajesh
1 Replies
RK(4)							     Kernel Interfaces Manual							     RK(4)

NAME
rk - RK-11/RK05 disk SYNOPSIS
/sys/conf/SYSTEM: NRK rk_drives # RK05 /etc/dtab: #Name Unit# Addr Vector Br Handler(s) # Comments rk ? 177400 220 5 rkintr # rk05 major device number(s): raw: 15 block: 6 minor device encoding: specifies drive: <rk_drive> DESCRIPTION
Minor device numbers are drive numbers on one controller. The standard device names begin with ``rk'' followed by the drive number and then the letter "h". The character ? stands here for a drive number in the range 0-7. The block files access the disk via the system's normal buffering mechanism and may be read and written without regard to physical disk records. There is also a `raw' interface which provides for direct transmission between the disk and the user's read or write buffer. A single read or write call results in exactly one I/O operation and therefore raw I/O is considerably more efficient when many words are transmitted. The names of the raw files conventionally begin with an extra `r.' In raw I/O the buffer must begin on a word (even) boundary, and counts should be a multiple of 512 bytes (a disk sector). Likewise seek calls should specify a multiple of 512 bytes. DISK SUPPORT
The rk driver does not support pseudo-disks (partitions). Each file rk?h refers to the entire drive as a single sequentially addressed file. Each drive has 4872 512-byte blocks. It's not clear what one would do with one of these drives if one had one ... FILES
/dev/rk[0-7]h block files /dev/rrk[0-7]h raw files /dev/MAKEDEV script to create special files /dev/MAKEDEV.local script to localize special files SEE ALSO
hk(4), ra(4), ram(4), rl(4), rp(4), rx(4), si(4), xp(4), dtab(5), autoconfig(8) DIAGNOSTICS
rk%d: hard error sn%d er=%b ds=%b. An unrecoverable error occurred during transfer of the specified sector of the specified disk. The contents of the two error registers are also printed in octal and symbolically with bits decoded. The error was either unrecoverable, or a large number of retry attempts could not recover the error. rk%d: write locked. The write protect switch was set on the drive when a write was attempted. The write operation is not recoverable. BUGS
In raw I/O read and write(2) truncate file offsets to 512-byte block boundaries, and write scribbles on the tail of incomplete blocks. Thus, in programs that are likely to access raw devices, read, write and lseek(2) should always deal in 512-byte multiples. DEC-standard error logging should be supported. A program to analyze the logged error information (even in its present reduced form) is needed. 3rd Berkeley Distribution August 20, 1987 RK(4)
All times are GMT -4. The time now is 11:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy