<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/12964" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-01-18T12:36:16-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/12964</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-01-18T12:36:16-04:00</updated>

		<published>2007-01-18T12:36:16-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69704#p69704</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69704#p69704"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69704#p69704"><![CDATA[
@DragnLord:<br>Actually, you can't have both paths within the same string.<br>In this case, the command should be "/usr/local/bin/screen", and it's first argument should be "/home/rix/pisg/pisg". You cannot concatenate command and arguments into a single string, and then execute it with exec<br><br>ie:<div class="codebox"><p>Code: </p><pre><code>exec "/usr/local/bin/screen /home/rix/pisg/pisg"   #Will not workexec /usr/local/bin/screen /home/rix/pisg/pisg     #Will workexec "/usr/local/bin/screen" "/home/rix/pisg/pisg" #Will work</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jan 18, 2007 12:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DragnLord]]></name></author>
		<updated>2007-01-18T02:15:14-04:00</updated>

		<published>2007-01-18T02:15:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69699#p69699</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69699#p69699"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69699#p69699"><![CDATA[
quick note about screen:<br>if the location for screen is /usr/bin/screen, then you need to include the first /<br>"/usr/bin/screen /home/rix/pisg/pisg"<br>not<br>"usr/bin/screen /home/rix/pisg/pisg"<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4461">DragnLord</a> — Thu Jan 18, 2007 2:15 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-01-17T18:44:35-04:00</updated>

		<published>2007-01-17T18:44:35-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69698#p69698</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69698#p69698"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69698#p69698"><![CDATA[
Ohh.. seems you've mixed both of my two different approaches into one :/<br>if you go for the "catch {exec $pisgexe &amp;} error" approach, leave pisgexe set to "/home/rix/pisg/pisg", not [open "|/home/rix/pisg/pisg" "RDWR"]<br><br>================================================================<br><br><br>In the case you'd like to go with the "command pipe"-option, you should still set pisgexe to "/home/rix/pisg/pisg". Then, when you wish to run the update, do something like this:<br><br>Open the command-pipe and set up a fileevent handler:<div class="codebox"><p>Code: </p><pre><code>set procID [open "|${pisgexe}" "RDWR"]fileevent $procID readable [list checkpisg $procID]</code></pre></div>This assumes there is a proc named "checkpisg" that is executed whenever there is readable output from pisg. It has two important tasks to perform, depending on the "end of file"-status of the process; 1. read a single line using "gets" (if not eof), and 2. close the command pipe (if eof).<br>In the case pisg generates an error, this will be returned when you try to close the command pipe.<br><br>A skeleton-proc for checkpisg; you'll probably wish to modify it to suite your needs:<div class="codebox"><p>Code: </p><pre><code>proc checkpisg {fileid} { if {![eof $fileid]} {  #Read some data from pisg, pisg is still running  set txt [gets $fileid] } else {  if {[catch {close $fileid} error]} {   #what to do if there's an error  } else {   #everything went ok  } }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Jan 17, 2007 6:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rix]]></name></author>
		<updated>2007-01-17T18:03:05-04:00</updated>

		<published>2007-01-17T18:03:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69692#p69692</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69692#p69692"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69692#p69692"><![CDATA[
Yeah, the close function was absolutely missing. Also im not very sure where should i place the close function. Atm processes are still defuncted.<br><div class="codebox"><p>Code: </p><pre><code>set pisgver "0.70"#Location of pisg execuitable perl scriptset pisgexe [open "|/home/rix/pisg/pisg" "RDWR"]#URL of the generated statsset pisgurl "http://www.starpump.ee/jutukas/stats"#channel that the stats are generated forset pisgchan "#starpump"#Users with these flags can operate this functionset pisgflags "nm"#How often the stats will be updated in minutes, ie: 30 - stats will be updated every 30 minutesset pisgtime "60"set pisg_server "starpump.ee"set pisg_user "user0071"set pisg_pass "******"set pisg_localdir "/home/rix/pisg/index.html"set pisg_remotedir "stats"bind pub $pisgflags !statsup pub:pisgcmdproc pub:pisgcmd {nick host hand chan arg} {   global pisgexe pisgurl pisgchan   if {[catch {exec $pisgexe &amp;} error]} { append out "$pisgexe an error occured: [string totitle $error]" }    else {      catch {close $pisgexe}     set status "okay"     }   if {$status == "okay"} {     puthelp "PRIVMSG $pisgchan :Statistika on edukalt koostatud, jätkan üleslaadimist..."     set pisg_localfile "$pisg_localdir"     set pisg_remotefile "$pisg_remotedir/index.html"     sendftp $pisg_localfile $pisg_server $pisg_user $pisg_pass $pisg_remotefile   }   else {     puthelp "PRIVMSG $pisgchan :$out"   }   puthelp "PRIVMSG $pisgchan :Statistika on üles laetud: $pisgurl"}proc pisgcmd_timer {} {   global pisgexe pisgurl pisgchan pisgtime   append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }   puthelp $out   timer $pisgtime pisgcmd_timer}if {![info exists {pisgset}]} {  set pisgset 1  timer 2 pisgcmd_timer}putlog "pisg.tcl $pisgver loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6753">rix</a> — Wed Jan 17, 2007 6:03 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-01-17T16:21:38-04:00</updated>

		<published>2007-01-17T16:21:38-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69687#p69687</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69687#p69687"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69687#p69687"><![CDATA[
you'll have to close the file-descriptor opened by the open-command once it completes, hence the fileevents. Otherwize you'll end up with stale or zombified processes.<br>Did you try the "catch {exec $pisgexe &amp;} error" approach?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Jan 17, 2007 4:21 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rix]]></name></author>
		<updated>2007-01-17T15:34:07-04:00</updated>

		<published>2007-01-17T15:34:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69683#p69683</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69683#p69683"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69683#p69683"><![CDATA[
Yeah, i like the idea of using screen, but it gave error:<br>[20:29:07] &lt;StarBot&gt; usr/bin/screen /home/rix/pisg/pisg an error occured: Couldn't execute "usr/bin/screen /home/rix/pisg/pisg": no such file or directory<br><br>Even though usr/bin/screen is a correct location of screen.<br><br>The open function works very well, bot doesn't halt. Unfortunately i have defunct processes now:<br>13419 ?        Z      4:31 [pisg] &lt;defunct&gt;<br><br>It seems that my whole code is very dodgy. Aargh, let it be then. Thanks for support though. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6753">rix</a> — Wed Jan 17, 2007 3:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-01-17T12:47:41-04:00</updated>

		<published>2007-01-17T12:47:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69681#p69681</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69681#p69681"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69681#p69681"><![CDATA[
One option might also be to execute it with <div class="codebox"><p>Code: </p><pre><code>open "|/home/rix/pisg/pisg" "RDWR"</code></pre></div>, setting the file-descriptor to nonblocking mode (using fconfigure), and implement some fileevents to keep track on when it completes (the file-descriptor goes eof). Should work on most platforms.<br><br>You could probably also try this: <div class="codebox"><p>Code: </p><pre><code>...  if {[catch {exec $pisgexe &amp;} error]} {...</code></pre></div>This one should not require any further actions, however you will not be able to read any stdout output from pisg (not that you do so now either)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Jan 17, 2007 12:47 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[DragnLord]]></name></author>
		<updated>2007-01-17T10:19:08-04:00</updated>

		<published>2007-01-17T10:19:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69676#p69676</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69676#p69676"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69676#p69676"><![CDATA[
If you are running the eggdrop from a unix-like shell; you would probably do well to use <a href="http://johoho.eggheads.org/eggdrop/modules.htm#bgexec" class="postlink">bgexec</a>, or change the script to implement the screen program if available on your shell server by using<div class="codebox"><p>Code: </p><pre><code>set pisgexe "/usr/local/bin/screen /home/rix/pisg/pisg"</code></pre></div>(this assumes that the screen program is located at /usr/local/bin/screen, using <div class="codebox"><p>Code: </p><pre><code>which screen</code></pre></div> at shell prompt will tell you where it is if it is installed)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=4461">DragnLord</a> — Wed Jan 17, 2007 10:19 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-01-17T00:44:39-04:00</updated>

		<published>2007-01-17T00:44:39-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69671#p69671</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69671#p69671"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69671#p69671"><![CDATA[
Lack of thread support in the bot?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Jan 17, 2007 12:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rix]]></name></author>
		<updated>2007-01-16T16:14:56-04:00</updated>

		<published>2007-01-16T16:14:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=69662#p69662</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=69662#p69662"/>
		<title type="html"><![CDATA[bot dies (ping timeout), when script is triggered]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=69662#p69662"><![CDATA[
Hello!<br><br>It seems that my bot keeps dieing when "big" scripts are triggered. Such like pisg-0.5.tcl. Bot dies with error message "Ping timeout" when pisg is executed and log file is being analyzed.<br><br>The code should be okay, but why does bot die?<br><br>Another mixed script, that generates statistics but bot dies in middle of it:<div class="codebox"><p>Code: </p><pre><code>set pisgver "0.70"#Location of pisg execuitable perl scriptset pisgexe "/home/rix/pisg/pisg"#URL of the generated statsset pisgurl "http://www.starpump.ee/jutukas/stats"#channel that the stats are generated forset pisgchan "#starpump"#Users with these flags can operate this functionset pisgflags "nm"#How often the stats will be updated in minutes, ie: 30 - stats will be updated every 30 minutesset pisgtime "60"set pisg_server "starpump.ee"set pisg_user "user0071"set pisg_pass "******"set pisg_localdir "/home/rix/pisg/index.html"set pisg_remotedir "stats"bind pub $pisgflags !statsup pub:pisgcmdproc pub:pisgcmd {nick host hand chan arg} {   global pisgexe pisgurl pisgchan   if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "okay" }   if {$out == "okay"} {    puthelp "PRIVMSG $pisgchan :Statistika on edukalt koostatud, jätkan üleslaadimist..."    set pisg_localfile "$pisg_localdir"    set pisg_remotefile "$pisg_remotedir/index.html"    pisg_sendftp $pisg_localfile $pisg_server $pisg_user $pisg_pass $pisg_remotefile   }   else {    puthelp "PRIVMSG $pisgchan :$out"   }   puthelp "PRIVMSG $pisgchan :Statistika on üles laetud: $pisgurl"}proc pisgcmd_timer {} {   global pisgexe pisgurl pisgchan pisgtime   append out "PRIVMSG $pisgchan :" ; if {[catch {exec $pisgexe} error]} { append out "$pisgexe an error occured: [string totitle $error]" } else { append out "Stats Updated: $pisgurl" }   puthelp $out   timer $pisgtime pisgcmd_timer}if {![info exists {pisgset}]} {  set pisgset 1  timer 2 pisgcmd_timer}proc pisg_sendftp { localfile server user pass remotefile } {  global pingcheck  if {![file exist $localfile]} {    return "sendftp: $localfile ei eksisteeri."  }  set noftp [catch {set ftpprog [exec which ftd]}]  if {$noftp} {    if {[file executable /usr/bin/ftp]} {      set ftpprog /usr/bin/ftp      set noftp 0    }    if {[file executable /bin/ftp]} {      set ftpprog /bin/ftp      set noftp 0    }  }  if {$noftp} { return "sendftp: Sul puudub 'ftp' tööriist" }  set pipe [open "|$ftpprog -n $server" w]  puts $pipe "user $user $pass"  puts $pipe "bin"  puts $pipe "put $localfile $remotefile"  puts $pipe "quit"  close $pipe  return 1}putlog "pisg.tcl $pisgver loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=6753">rix</a> — Tue Jan 16, 2007 4:14 pm</p><hr />
]]></content>
	</entry>
	</feed>
