<?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/9762" />

	<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>2005-06-05T14:14:08-04:00</updated>

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

		<entry>
		<author><name><![CDATA[thedude0001]]></name></author>
		<updated>2005-06-05T14:14:08-04:00</updated>

		<published>2005-06-05T14:14:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50278#p50278</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50278#p50278"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50278#p50278"><![CDATA[
Thanks a lot, just applied that <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=5806">thedude0001</a> — Sun Jun 05, 2005 2:14 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[greenbear]]></name></author>
		<updated>2005-06-05T12:28:19-04:00</updated>

		<published>2005-06-05T12:28:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50275#p50275</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50275#p50275"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50275#p50275"><![CDATA[
that said, just add 'close $fp' after the 'set lines ....' line<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=24">greenbear</a> — Sun Jun 05, 2005 12:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Alchera]]></name></author>
		<updated>2005-06-05T10:16:37-04:00</updated>

		<published>2005-06-05T10:16:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50271#p50271</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50271#p50271"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50271#p50271"><![CDATA[
<blockquote class="uncited"><div>What are you using the ftp for? And why do you need a public announcement of bandwidth / per user?</div></blockquote>It's a file sharing script. I believe forum rules prevent us from assisting anyone with these type of scripts anyway.<br><br>Consigning this thread to the junkyard may be appropriate.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3646">Alchera</a> — Sun Jun 05, 2005 10:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-05T07:51:46-04:00</updated>

		<published>2005-06-05T07:51:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50267#p50267</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50267#p50267"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50267#p50267"><![CDATA[
Heh and we dont have to help you. I hope you enjoy learning TCL scripting.  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=":wink:" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Sun Jun 05, 2005 7:51 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[thedude0001]]></name></author>
		<updated>2005-06-05T07:38:50-04:00</updated>

		<published>2005-06-05T07:38:50-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50266#p50266</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50266#p50266"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50266#p50266"><![CDATA[
Well, in my world a ftpd is used for serving files, no matter what kind of files these are... And if you want to know what files I am serving and who has access to this ftpd or what color my underwear has the answer is quite simple: That's none of your damn business <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5806">thedude0001</a> — Sun Jun 05, 2005 7:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-05T07:21:41-04:00</updated>

		<published>2005-06-05T07:21:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50264#p50264</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50264#p50264"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50264#p50264"><![CDATA[
It all depends on the type of files you are serving.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Sun Jun 05, 2005 7:21 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[thedude0001]]></name></author>
		<updated>2005-06-05T06:53:48-04:00</updated>

		<published>2005-06-05T06:53:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50262#p50262</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50262#p50262"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50262#p50262"><![CDATA[
Well, what is a ftpd used for? I use mine for serving files...<br><br>And only the overall traffic is announced, not the traffic / user. The script just reads the different userfiles to get this data.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5806">thedude0001</a> — Sun Jun 05, 2005 6:53 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[^DooM^]]></name></author>
		<updated>2005-06-05T05:45:34-04:00</updated>

		<published>2005-06-05T05:45:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50260#p50260</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50260#p50260"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50260#p50260"><![CDATA[
What are you using the ftp for? And why do you need a public announcement of bandwidth / per user?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=3723">^DooM^</a> — Sun Jun 05, 2005 5:45 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[thedude0001]]></name></author>
		<updated>2005-06-05T05:15:31-04:00</updated>

		<published>2005-06-05T05:15:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=50259#p50259</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=50259#p50259"/>
		<title type="html"><![CDATA[Script is not closing files (I think)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=50259#p50259"><![CDATA[
I've got a lovely little script here that announces the ammount of traffic produced on a glftpd server running on the same machine. Now the time-based announcement was added later and not present in the original script. The script works fine for several days, then it starts telling me that 0.0GB traffic were used this month. Taking a look at the logfile (after enabling some debug lines in the script) I see this:<br><blockquote class="uncited"><div>[02:00] /glftpd/ftp-data/users/dude<br>[02:00] glftpd-traffic.tcl: couldn't open "/glftpd/ftp-data/users/dude": too many open files <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"></div></blockquote>Taking a closer look at the script it looks to me that the user files are never closed, only opened when the script wants to read the data, and after some days there are 1024 files open (the ulimit on this box) and no new files can be opened. My problem is that I have no big knowledge of TCL and don't know where and how I should close those files, so any help would be greatly appreciated <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>Here's the script:<br><div class="codebox"><p>Code: </p><pre><code># v-1.05 22 Feb 05 (21:06:58)# Don't know who the original author is, but I'm releasing this# out with a few fixes to get around looping into negatives above# 2GB when reading k size. -Genocaust# glftpd users directoryset glftpdusers "/glftpd/ftp-data/users"# output themes#  variables:#   $traffick - traffic in kilobytes#   $trafficm - traffic in megabytes#   $trafficg - traffic in gigabytes#   $msgtag   - i just prepend to the outputs to match my bot themeset msgtag          "\002Alcatraz\002 :: \[\002stats \002\]"set gtoutput(all)   {$msgtag \002${trafficg}\002GB have passed through Alcatraz.}set gtoutput(month) {$msgtag While passing through Alcatraz, \002${trafficg}\002GB had an out of body experience this month.}set gtoutput(wk)    {$msgtag \002${trafficg}\002GB saw Elvis this week in Alcatraz.}set gtoutput(day)   {$msgtag Today \002${trafficg}\002GB all agreed that 'if the dick don't fit, you must acquit.'}# triggerset gtcommand "!traffic"# usage is: trigger [day/wk/month/all] - if not period is specified the default will be usedset gtdefault "month"#regular announcesbind time - "00 00 * * *" gtgltraffic:tbind time - "00 02 * * *" gtgltraffic:tbind time - "00 04 * * *" gtgltraffic:tbind time - "00 06 * * *" gtgltraffic:tbind time - "00 08 * * *" gtgltraffic:tbind time - "00 10 * * *" gtgltraffic:tbind time - "00 12 * * *" gtgltraffic:tbind time - "00 14 * * *" gtgltraffic:tbind time - "00 16 * * *" gtgltraffic:tbind time - "00 18 * * *" gtgltraffic:tbind time - "00 20 * * *" gtgltraffic:tbind time - "00 22 * * *" gtgltraffic:tproc gtgltraffic:t {min h d m y} {   gtgltraffic {} {} {} #Alcatraz {}   return 0}proc gtgltraffic {nick host hand chan arg} {set monthup 0set monthdn 0global msgtagif {[llength [split $arg]]==0} {set period $::gtdefault} else {set period [lindex $arg 0]}if {![info exists ::gtoutput($period)]} {puthelp "PRIVMSG $chan :usage: $::gtcommand \[day/wk/month/all\]"return}foreach user [glob -nocomplain $::glftpdusers/*] {putlog $userif {[catch {open $user} fp]} {putlog "glftpd-traffic.tcl: $fp :("continue}set lines [split [read $fp] \n]foreach line $lines {if {[lindex [split $line] 0]=="[string toupper $period]UP"} {putlog $lineforeach {files size time} [lrange [split $line] 1 end] {if {$size==""} {continue}incr monthup $size}} elseif {[lindex [split $line] 0]=="[string toupper $period]DN"} {putlog $lineforeach {files size time} [lrange [split $line] 1 end] {if {$size==""} {continue}incr monthdn $size}}}}set traffick [expr wide($monthdn) + wide($monthup)]set trafficm [format %.1f [expr wide($traffick) /1024.0]]set trafficg [format %.1f [expr wide($trafficm) /1024.0]]puthelp "PRIVMSG $chan :[subst -nocommands $::gtoutput($period)]"}bind pub - $gtcommand gtgltrafficputlog "glFTPD Traffic 1.05 loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5806">thedude0001</a> — Sun Jun 05, 2005 5:15 am</p><hr />
]]></content>
	</entry>
	</feed>
