Hi Farzaneh,

I have a similar script doing log rotation too, and after executing kamcmd, you may remove the old files (*.temp in your case).
In my case, instead of deleting file, I move them to another folder (to be processed by the CDR processor) right after executing kamcmd, who will create new cdr files. And it works great! Just bear in mind that even after renaming the CDR files to *.temp, Kamailio will still point to the files and keep track of the cdrs....
Docs have a nice article about rotating files:
https://www.kamailio.org/docs/modules/stable/modules/db_flatstore.html#rotating 
and also states that:
    " Note that at this point Kamailio will still be writing all data into the renamed files"

HTH,

Sérgio Charrua


‪On Sun, May 19, 2024 at 1:15 PM ‫فرزانه سلطان زاده via sr-users‬‎ <sr-users@lists.kamailio.org> wrote:‬
Hi,
Hope to find you well,

I have a question about the 'db_flatstore' module in Kamailio. Here's my script for log rotation:

    for f in acc_cdrs_*.log; do
        mv -- "$f" "${f%.log}.temp"
    done
    docker exec -it pcscf kamcmd flatstore.k_rotate
    rm *.temp

I want to know if the kamcmd command is blocking and the files can be removed after that or if I should wait for it to be done before removing the renamed files.

Regards,
Farzaneh
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: