<div>I use to send a custom even to stop a lua script which run an <span style="background-color:rgb(255,255,255);color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px">infinite</span> loop :</div>

<div>luarun myscript.lua stop</div><div><br></div><div><div>if argv[1] then</div><div>    i=1</div><div>    while argv[i] do</div><div>        if argv[i] == &quot;stop&quot; then</div><div>            --Send Stop message</div>

<div>            local event = freeswitch.Event(&quot;custom&quot;, &quot;lua::stop_event&quot;)</div><div>            event:addHeader(&quot;Action&quot;, &quot;stop&quot;)</div><div>            event:fire()</div><div>            logger(&quot;Sent stop message to lua script&quot;)</div>

<div>            return</div><div>        end</div><div>        i=i+1</div><div>    end</div><div>    return</div><div>end</div></div><div><br></div><div>and then in the loop I listen for those events! </div><div><br></div>

<div>you can find a full example here :</div><div><a href="https://github.com/Star2Billing/newfies-dialer/blob/develop/lua/listener.lua">https://github.com/Star2Billing/newfies-dialer/blob/develop/lua/listener.lua</a></div>

<div><br></div><div><br></div><br><div class="gmail_quote">On Wed, Dec 26, 2012 at 8:12 PM, Muhammad Naseer Bhatti <span dir="ltr">&lt;<a href="mailto:nbhatti@gmail.com" target="_blank">nbhatti@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div>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.<div class="im">

<br><div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">

<br>Thanks,</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">

--</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">

Muhammad Naseer Bhatti</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">

<br></div><br>
</div>
<br></div><div><div class="h5"><div><div>On Dec 26, 2012, at 8:14 PM, Michael Collins &lt;<a href="mailto:msc@freeswitch.org" target="_blank">msc@freeswitch.org</a>&gt; wrote:</div><br><blockquote type="cite">Have you been able to determine why it&#39;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&#39;t know how easy/difficult it is to pick out which one is running Lua.<br>


-MC<br><br><div class="gmail_quote">On Sun, Dec 23, 2012 at 2:21 AM, Muhammad Naseer Bhatti <span dir="ltr">&lt;<a href="mailto:nbhatti@gmail.com" target="_blank">nbhatti@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div style="word-wrap:break-word"><div><br></div>Looks like simple one, but I can&#39;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&#39;t terminate itself? Of if we can come up with a way to monitor the thread and stop it?<br>


<div>
<div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">


<br>Thanks,</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">


--</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">


Muhammad Naseer Bhatti</div><div style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">


<br></div><br>
</div>

<br></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com/" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com/" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org/" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Michael S Collins<br>Twitter: @mercutioviz<br><a href="http://www.freeswitch.org/" target="_blank">http://www.FreeSWITCH.org</a><br><a href="http://www.cluecon.com/" target="_blank">http://www.ClueCon.com</a><br>


<a href="http://www.ostag.org/" target="_blank">http://www.OSTAG.org</a><br><br>
_________________________________________________________________________<br>Professional FreeSWITCH Consulting Services:<br><a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br><a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>

<br>FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br><a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br><br>Official FreeSWITCH Sites<br><a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>

<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br><a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br><br>FreeSWITCH-users mailing list<br><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>

<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>

<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br></blockquote></div><br></div></div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="border-collapse:collapse;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px"><div>Kinds regards,</div><div>/Areski</div><div><br>

</div>----<br><b>Arezqui Belaid</b>, <div><a href="mailto:areski@gmail.com" style="color:rgb(17,85,204)" target="_blank">areski@gmail.com</a> / <a value="+34650784355" style="color:rgb(17,85,204)">+34650784355</a><div><br>

Founder at Star2Billing (<a href="http://www.star2billing.com/" style="color:rgb(17,85,204)" target="_blank">www.star2billing.com</a>)<br>Author @ A2Billing (<a href="http://www.a2billing.net/" style="color:rgb(17,85,204)" target="_blank">www.a2billing.net</a>), @ Newfies-Dialer (<a href="http://www.newfies-dialer.org/" style="color:rgb(17,85,204)" target="_blank">www.newfies-dialer.org</a>), @ CDR-Stats (<a href="http://www.cdr-stats.org/" style="color:rgb(17,85,204)" target="_blank">www.cdr-stats.org</a>)<br>

----<br>Twitter : <a href="http://twitter.com/areskib" style="color:rgb(17,85,204)" target="_blank">http://twitter.com/areskib</a> / LinkedIN : <a href="http://www.linkedin.com/in/areski" style="color:rgb(17,85,204)" target="_blank">http://www.linkedin.com/in/areski</a></div>

</div></span>