Hello!
I was wondering how everyone uses exec_cmd(). I'm using it to call an external script directly from a worker route which locks it for the time of execution. If all that is needed is to call it and forget, should the best option be to call the async route with exec_cmd()?
Thanks a lot for any input on this topic!
Hello,
In my opinion you should find another way, if you concerned about performance.
Just to give two ideas: you could e.g. call an HTTP API from the script, or you put it in a queue structure (there are several modules) and then have a worker from outside of Kamailio processes it.
Cheers,
Henning
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of ????????? ??????? Sent: Tuesday, November 8, 2022 3:24 PM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: [SR-Users] External script
Hello!
I was wondering how everyone uses exec_cmd(). I'm using it to call an external script directly from a worker route which locks it for the time of execution. If all that is needed is to call it and forget, should the best option be to call the async route with exec_cmd()?
Thanks a lot for any input on this topic!
Hello,
you can use & at the end of command to set its execution in background, which should result in exec_cmd() returning immediately, no longer waiting for command execution to terminate. Like:
exec_cmd("/path/to/myscript.sh &");
Cheers, Daniel
On 08.11.22 15:24, Володимир Іванець wrote:
Hello!
I was wondering how everyone uses exec_cmd(). I'm using it to call an external script directly from a worker route which locks it for the time of execution. If all that is needed is to call it and forget, should the best option be to call the async route with exec_cmd()?
Thanks a lot for any input on this topic!
Kamailio - Users Mailing List - Non Commercial Discussions sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello all!
Henning, thank you for the suggestion!
Daniel, your suggestion worked perfectly for my case.
Thank you!
вт, 8 лист. 2022 р. о 18:07 Daniel-Constantin Mierla miconda@gmail.com пише:
Hello,
you can use & at the end of command to set its execution in background, which should result in exec_cmd() returning immediately, no longer waiting for command execution to terminate. Like:
exec_cmd("/path/to/myscript.sh &");
Cheers, Daniel
On 08.11.22 15:24, Володимир Іванець wrote:
Hello!
I was wondering how everyone uses exec_cmd(). I'm using it to call an external script directly from a worker route which locks it for the time of execution. If all that is needed is to call it and forget, should the best option be to call the async route with exec_cmd()?
Thanks a lot for any input on this topic!
Kamailio - Users Mailing List - Non Commercial Discussions sr-users@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to
the sender!
Edit mailing list options or unsubscribe: https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.com www.twitter.com/miconda -- www.linkedin.com/in/miconda