This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

need a script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

need a script

Post by CuteBangla »

i need a script what can make a live index page that will show all public msg fron a channel & it will update that html page in evry 1 min that can help me out to see all the public msg of a channel live ...
Last edited by CuteBangla on Sat Apr 15, 2006 1:55 am, edited 1 time in total.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Look at the second script I wrote in this thread.
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Post by CuteBangla »

is this will be the script?

Code: Select all

set logfile "/home/blabla/public_html/index.html" 
bind pubm - * cmd:log 
bind pubm - * cmd:log 

proc cmd:log {n u h c t} { 
        set cmdlog [open ${::logfile} a+] 
        set timestamp [clock format [clock seconds]] 
        puts $cmdlog "\[$timestamp\] $t used by $n in $c" 
        close $cmdlog 
} 
i want to have that as html file
that any1 can see & mayb that index file ill refresh after evry X seconds or after a new public message in the channel .... & delet old line after evry 20 new lines ...
DragnLord wrote:Look at the second script I wrote in this thread.
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

A single 'bind pubm - * cmd:log' is all that is needed.
The script would update the page in real time.
Changing

Code: Select all

puts $cmdlog "\[$timestamp\] $t used by $n in $c"
to

Code: Select all

puts $cmdlog "\[$timestamp\] <$n> $t <br>"
will format the file for html.

Code: Select all

set timestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
will give a better timestamp for webpages
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Post by CuteBangla »

so is this the final script?
will it delete evry old line after X new lines?

Code: Select all

set logfile "/home/blabla/public_html/index.html" 
bind pubm - * cmd:log 

proc cmd:log {n u h c t} { 
	set cmdlog [open ${::logfile} a+] 
	set timestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
	puts $cmdlog "\[$timestamp\] <$n> $t <br>" 
	close $cmdlog 
} 
User avatar
DragnLord
Owner
Posts: 711
Joined: Sat Jan 24, 2004 4:58 pm
Location: C'ville, Virginia, USA

Post by DragnLord »

Code: Select all

set logfile "/home/blabla/public_html/index.html"
# set for logfile length
set linecount 20
bind pubm - * cmd:log
set filecount 0
proc cmd:log {n u h c t} {
   set cmdlog [open ${::logfile} a+]
   set timestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
   puts $cmdlog "\[$timestamp\] <$n> $t <br>"
   close $cmdlog
   set pline [lindex [exec wc -l ${::logfile}] 0]
   if {${::filecount} >= ${::linecount}}{
      exec tail -n${::linecount} ${::logfile} > ${::logfile}
      set ::filecount 0
   }
   incr ::filecount
} 
Give this a try. Should update the webpage the way you want.
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Post by CuteBangla »

will u please tell me how can i define a singel channel??


DragnLord wrote:

Code: Select all

set logfile "/home/blabla/public_html/index.html"
# set for logfile length
set linecount 20
bind pubm - * cmd:log
set filecount 0
proc cmd:log {n u h c t} {
   set cmdlog [open ${::logfile} a+]
   set timestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
   puts $cmdlog "\[$timestamp\] <$n> $t <br>"
   close $cmdlog
   set pline [lindex [exec wc -l ${::logfile}] 0]
   if {${::filecount} >= ${::linecount}}{
      exec tail -n${::linecount} ${::logfile} > ${::logfile}
      set ::filecount 0
   }
   incr ::filecount
} 
Give this a try. Should update the webpage the way you want.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Change

Code: Select all

bind pubm - * cmd:log
to

Code: Select all

bind pubm - "#chan *" cmd:log
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Post by CuteBangla »

one more thnk is it possible to upload this html file to a remote host folder
i mean not in shell in some other host ??
C
CuteBangla
Halfop
Posts: 58
Joined: Mon Feb 27, 2006 10:47 pm
Location: Dhaka, Bangladesh
Contact:

Post by CuteBangla »

is there any way to save tha log to a remote ftp folder??
Post Reply