STEP 1.  Don't move the files yourself.  'pkill -HUP freeswitch' or 'fsctl send_sighup' at the CLI or fs_cli -x 'fsctl send_sighup'  will rotate them.
STEP 2.  Relax and don't try so hard.  ;)
/b

On Jan 20, 2012, at 4:11 AM, Henrik Aagaard Sørensen wrote:

I'm in the beginning of development for billing on my FS instance.
Currently I'm just in the log-rotation and uploading of the .csv-files
stage.

I'm having trouble understanding completely how this should work, to be
"bullet-proof" in a production environment.

I've read the "Example Perl Script for CDR into MySQL" in
http://wiki.freeswitch.org/wiki/Mod_cdr_csv.

What I would like to accomplish is uploading the Master.csv-file to another
server, which should take care of all the billing, so it doesn't interfere
with the VoIP-server.

But how can I make sure, that when I'm uploading the Master.csv file, that
FS isn't currently writing to the file as well.

I'm thinking of moving the Master.csv to Master-YYYY-MM-DD-HH-MM.csv every
minute and then uploading those files to another server.
But then again, how can I make sure, that when moving the file to
Master-YYYY-MM-DD-HH-MM.csv that FS isn't writing to the file?

Can someone share some light on this matter?

-- 
Brian West 
FreeSWITCH Solutions, LLC
Phone: +1 (918) 420-9266 
Fax:   +1 (918) 420-9267