Hi,

I wrote a bash script which is doing postgresql request and extract data
that I need to export to csv file and then convert is to XLS with column
width set (perl script):

For example you can set a crontab with value below:

00 03 * * 2-5      /usr/local/sbin/extractcdrperday.sh
05 0 * * 1       /usr/local/sbin/extractcdrperweek.sh


Copy script in attachment in /usr/local/sbin/ folder give them execution
right with chmod

If you need to convert csv to xls you should install few librairies with
CPAN.

do cpan
then install Spreadsheet::WriteExcel
and also install Text::CSV_XS

My requirement was to have a script running each open day to extract data
from the previous day (call per agent per day) and also once per week to
extract data from agent for the entire week, so you should modify the
postgresql request following your needs.

I hope it can help you.

Best Regards

Cyril CONSTANTIN



2012/4/5 Tony Graziano <[email protected]>

> I would imagine if you can export by hand, then you can script it and run
> via a cron job.
>
> If you need this done daily, you might consider setting up an odbc
> database connection to postgres cdr db from whatever system is processing
> your csv file instead and getting it directly though.
>
> On Thu, Apr 5, 2012 at 4:45 AM, Henry Dogger <[email protected]> wrote:
>
>>  Hi,****
>>
>> ** **
>>
>> Is it possible to make an automated export csv file of the cdrs from the
>> day?****
>>
>> I would like to export the cdr data every day into a csv file, like I can
>> do by hand.****
>>
>> ** **
>>
>> Kind regards,****
>>
>> ** **
>>
>> Henry Dogger****
>>
>> Telecats BV****
>>
>> ** **
>>
>> _______________________________________________
>> sipx-users mailing list
>> [email protected]
>> List Archive: http://list.sipfoundry.org/archive/sipx-users/
>>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~
> Tony Graziano, Manager
> Telephone: 434.984.8430
> sip: [email protected]
> Fax: 434.465.6833
> ~~~~~~~~~~~~~~~~~~
> Linked-In Profile:
> http://www.linkedin.com/pub/tony-graziano/14/4a6/7a4
> Ask about our Internet Fax services!
> ~~~~~~~~~~~~~~~~~~
>
> LAN/Telephony/Security and Control Systems Helpdesk:
> Telephone: 434.984.8426
> sip: [email protected].**net<[email protected]>
>
> Helpdesk Customers: 
> http://myhelp.myitdepartment.**net<http://myhelp.myitdepartment.net>
> Blog: http://blog.myitdepartment.net
>
> _______________________________________________
> sipx-users mailing list
> [email protected]
> List Archive: http://list.sipfoundry.org/archive/sipx-users/
>

Attachment: extractcdrperday.sh
Description: Bourne shell script

Attachment: extractcdrperweek.sh
Description: Bourne shell script

Attachment: convertcsv2xls.sh
Description: Bourne shell script

_______________________________________________
sipx-users mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-users/

Reply via email to