stop a running lua script from luarun
Looks like simple one, but I can't figure it out if there a way to stop a lua script invoked via luarun which is stuck in an infinite loop and won't terminate itself? Of if we can come up with a way to monitor the thread and stop it? Thanks, -- Muhammad Naseer Bhatti
Have you been able to determine why it's stuck in an infinite loop? That would be a better long-term solution. In the meantime I think you can do top -H to see individual threads but I don't know how easy/difficult it is to pick out which one is running Lua. -MC On Sun, Dec 23, 2012 at 2:21 AM, Muhammad Naseer Bhatti <nbhatti@gmail.com>wrote:
Looks like simple one, but I can't figure it out if there a way to stop a lua script invoked via luarun which is stuck in an infinite loop and won't terminate itself? Of if we can come up with a way to monitor the thread and stop it?
Thanks, -- Muhammad Naseer Bhatti
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
No, I am running this loop myself. But I found other way to terminate the script, like look for a condition in each iteration of the loop and if condition is true terminate the loop. But the question remains the same, if there is a way to figure out which scripts are running to stop them if possible. Since all process are spawn by freeswitch top -H is not a handy solution. Thanks, -- Muhammad Naseer Bhatti On Dec 26, 2012, at 8:14 PM, Michael Collins <msc@freeswitch.org> wrote:
Have you been able to determine why it's stuck in an infinite loop? That would be a better long-term solution. In the meantime I think you can do top -H to see individual threads but I don't know how easy/difficult it is to pick out which one is running Lua. -MC
On Sun, Dec 23, 2012 at 2:21 AM, Muhammad Naseer Bhatti <nbhatti@gmail.com> wrote:
Looks like simple one, but I can't figure it out if there a way to stop a lua script invoked via luarun which is stuck in an infinite loop and won't terminate itself? Of if we can come up with a way to monitor the thread and stop it?
Thanks, -- Muhammad Naseer Bhatti
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org http://www.ClueCon.com http://www.OSTAG.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
I use to send a custom even to stop a lua script which run an infinite loop : luarun myscript.lua stop if argv[1] then i=1 while argv[i] do if argv[i] == "stop" then --Send Stop message local event = freeswitch.Event("custom", "lua::stop_event") event:addHeader("Action", "stop") event:fire() logger("Sent stop message to lua script") return end i=i+1 end return end and then in the loop I listen for those events! you can find a full example here : https://github.com/Star2Billing/newfies-dialer/blob/develop/lua/listener.lua On Wed, Dec 26, 2012 at 8:12 PM, Muhammad Naseer Bhatti <nbhatti@gmail.com>wrote:
No, I am running this loop myself. But I found other way to terminate the script, like look for a condition in each iteration of the loop and if condition is true terminate the loop. But the question remains the same, if there is a way to figure out which scripts are running to stop them if possible. Since all process are spawn by freeswitch top -H is not a handy solution.
Thanks, -- Muhammad Naseer Bhatti
On Dec 26, 2012, at 8:14 PM, Michael Collins <msc@freeswitch.org> wrote:
Have you been able to determine why it's stuck in an infinite loop? That would be a better long-term solution. In the meantime I think you can do top -H to see individual threads but I don't know how easy/difficult it is to pick out which one is running Lua. -MC
On Sun, Dec 23, 2012 at 2:21 AM, Muhammad Naseer Bhatti <nbhatti@gmail.com
wrote:
Looks like simple one, but I can't figure it out if there a way to stop a lua script invoked via luarun which is stuck in an infinite loop and won't terminate itself? Of if we can come up with a way to monitor the thread and stop it?
Thanks, -- Muhammad Naseer Bhatti
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Michael S Collins Twitter: @mercutioviz http://www.FreeSWITCH.org <http://www.freeswitch.org/> http://www.ClueCon.com <http://www.cluecon.com/> http://www.OSTAG.org <http://www.ostag.org/>
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Kinds regards, /Areski ---- *Arezqui Belaid*, areski@gmail.com / +34650784355 Founder at Star2Billing (www.star2billing.com) Author @ A2Billing (www.a2billing.net), @ Newfies-Dialer ( www.newfies-dialer.org), @ CDR-Stats (www.cdr-stats.org) ---- Twitter : http://twitter.com/areskib / LinkedIN : http://www.linkedin.com/in/areski
participants (3)
-
Areski
-
Michael Collins
-
Muhammad Naseer Bhatti