Hello Luggers,

A quick question.

Let's say I wanna rotate a log file upon reaching a certain size and the
file name is time dependent. logrotate configuration wildcards will not
help, so I'm writing a script to do it, my questions is, as per the pseudo
below

every x time
check file size
if size > y
cp oldfile oldfile-1 && echo > oldfile # (copy-truncate) because processes
have open fd's with oldfile
fi

If the file size is large, cp WILL take some time and CONCURRENTLY data is
still being written to the oldfile. *Will cp cater to every byte written to
the oldfile up until the micro-second "&& echo kicks in"? Or will there be
data loss?*

Thanks!

-- 
abulyomon

www.KiLLTHeUPLiNK.com

--~--~---------~--~----~------------~-------~--~----~
### Jordan Linux Users Group ###
http://Jolug.org/
http://groups.google.com/group/Jolug

### Ubuntu Jordan LoCo Team ###
https://wiki.ubuntu.com/JordanTeam
http://lists.ubuntu.com/ubuntu-jo

### Ojuba Linux ### 
http://ojuba.org/

### Jordan PHP ###
http://groups.google.com/group/JoPHP
-~----------~----~----~----~------~----~------~--~---

رد على