[Freeswitch-users] XML CDR resend curl command

Sergey Safarov s.safarov at gmail.com
Thu Mar 3 19:38:31 MSK 2016


You can check curl exitcode. If not zero, then do not delete file

On Thu, Mar 3, 2016, 13:48 John Nash <john.nash778 at gmail.com> wrote:

> When using XML CDR to resubmit XML CDR I have a shell script which resends
> XML CDR from error directory again to the web server (As per doc
> https://freeswitch.org/confluence/display/FREESWITCH/mod_xml_cdr)
>
> In this script following curl command is doing the trick
>
> for CDR in $(find $CDRDIR -name "*.cdr.xml"); do
>     echo "Resubmitting $(basename $CDR .cdr.xml)..."
>     echo -n 'cdr='$(cat $CDR) | \
>         curl -sS -X POST -f --$AUTH_SCHEME -u $CRED -d @- $URL >/dev/null \
>             && echo "OK, removing CDR file" \
>             && rm -f $CDR
> done
>
>
> My question is how to handle the case when even this submission fails
> because of any reason?..I want to skip the remove file step in case again
> some error happens with web server, How can I do that?
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160303/24cc2260/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list