Hi,
We have a simple shell command like this:
for xmlcdrfile in *.[login to view URL]; do curl -X POST --basic -u "UUUUUUU:PPPPPP" -d cdr=$(cat $xmlcdrfile) http://XXXXXXXX; done
which can be run to post files to an app server. It responds normally with a 200 OK. The addition of rm $xmlcdrfile before the done also deletes the file.
However,, if the post is unsuccessful the file gets deleted anyway.
We would like the above modifying so it can be safely run in cron and will only ever delete a file which has been sucesfully posted. In the event of an error, it should pass the file and process the next one.
Very quick job for someone who knows what they're doing with shell!
Thanks!