Are you actually able to get results out of the reply fifo?<br>It's been a long time since I created my bash fifo script so I don't remember all the particulars of what I ran into.<br>It can be important to start the read fifo before sending the command<br>
<br>Hear is a snippet from a bash fifo I did.<br><br>trap "\rm -f $dlg $fifo_reply ${fifo_answer}* 2> /dev/null; exit 1" 0<br>if [ ! -w $FIFO ] ; then # can I write to FIFO server?<br> echo "Error opening ser's FIFO $FIFO" >> $DEBUG_OUT<br>
echo "FAILED"<br> exit 1<br>fi<br>mkdir -p $fifo_dir 2> /dev/null<br>mkfifo $fifo_reply # create a reply FIFO<br>if [ $? -ne 0 ] ; then<br> echo "error opening reply fifo $fifo_reply" >> $DEBUG_OUT<br>
echo "FAILED"<br> exit 1<br>fi<br>chmod a+w $fifo_reply<br># start reader now so that it is ready for replies<br># immediately after a request is out<br>cat < $fifo_reply > $dlg &<br>fifo_job="$!"<br>
<br># set trap to cleanup in case of problems or outside kill<br>trap "kill -9 $fifo_job $fifo_answer_job 2>1 >> $DEBUG_OUT ; exit 1" 0<br># finally actually push command to the fifo<br>echo "reply pid: $fifo_job, reply fifo: $fifo_reply" >> $DEBUG_OUT<br>
<br>You may want to just use the fifo handeling built into opensipsctl<br>eg:<br>/path/opensipsctl fifo ps<br><br>Dave<br><br><br><div class="gmail_quote">On Mon, May 9, 2011 at 1:42 PM, Brett Nemeroff <span dir="ltr"><<a href="mailto:brett@nemeroff.com">brett@nemeroff.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Dave,<div>I don't think those are the issues. First of all, if I supply the full path to the reply fifo, I get an error message that the filename is invalid. More importantly, it doesn't work. :) without the full path, it does work.</div>
<div><br></div><div>Secondly, I don't think it's SELinux issue because it *does work* repeatedly over and over. But an extra carriage return spoils the fun for everyone and I can't fix it without restarting opensips.</div>
<div><br></div><div>Do you believe SELinux could cause an issue like that?<br>Thanks!</div><div>-Brett</div><div><div></div><div class="h5"><div><br><br><div class="gmail_quote">On Mon, May 9, 2011 at 3:39 PM, Dave Singer <span dir="ltr"><<a href="mailto:dave.dorasinger@gmail.com" target="_blank">dave.dorasinger@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Brett,<br>I believe you need the full path to the reply fifo.<br>Try:<br>echo -e ":address_dump:/tmp/my_fifo\n\n" > /tmp/opensips_fifo<br>
<br>you may also have a permissions ( chmod a+w /tmp/my_fifo ) and/or SELinux issue (very likely if SELinux is enabled, I posted a howto for SELinux in the list a number of months back)<br>
<br>Dave<br><br><div class="gmail_quote"><div><div></div><div>On Mon, May 9, 2011 at 9:40 AM, Brett Nemeroff <span dir="ltr"><<a href="mailto:brett@nemeroff.com" target="_blank">brett@nemeroff.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
Hello List,<div>So I've been doing some testing with the mi_fifo and found that it appears to be really fragile. Here's what I've done:</div><div><br></div><div>mkfifo /tmp/my_fifo</div><div>cat /tmp/my_fifo&</div>
<div>echo -e ":address_dump:my_fifo\n\n" > /tmp/opensips_fifo</div><div><div>*returns*</div><div>200 OK</div><div> 48 <1.2.3.4,2, 0, 0, NULL, NULL></div></div><div>** cat process ends</div><div>cat /tmp/my_fifo&</div>
<div><div>echo -e ":address_dump:my_fifo\n\n" > /tmp/opensips_fifo</div><div>** nothing</div><div><br></div><div>At this point, I can't make the fifo work again until I restart opensips. If I detach from the fifo (kill the cat, so to speak), and reattach it doesn't work. Nothing seems to make it responsive again. At first I though something was horribly broken, but then I removed one of my \n from the fifo command and now it works "as expected". Two new-lines shouldn't break the fifo, right?</div>
<div><br></div><div>Thanks!</div><div>-Brett</div><div><br></div><div><br></div><div><br></div><div></div></div>
<br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>David Singer<br>
</font><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>David Singer<br>