| View previous topic :: View next topic |
| Author |
Message |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 1:28 am Post subject: need a script |
|
|
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 ... _________________ SuMiT
iRC.CuteBangla.Com
Last edited by CuteBangla on Sat Apr 15, 2006 1:55 am; edited 1 time in total |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Sat Apr 15, 2006 1:51 am Post subject: |
|
|
| Look at the second script I wrote in this thread. |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 2:01 am Post subject: |
|
|
is this will be the script?
| Code: |
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. |
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Sat Apr 15, 2006 2:20 am Post subject: |
|
|
A single 'bind pubm - * cmd:log' is all that is needed.
The script would update the page in real time.
Changing
| Code: | | puts $cmdlog "\[$timestamp\] $t used by $n in $c" |
to
| Code: | | puts $cmdlog "\[$timestamp\] <$n> $t <br>" |
will format the file for html.
| Code: | | set timestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}] | will give a better timestamp for webpages |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 2:36 am Post subject: |
|
|
so is this the final script?
will it delete evry old line after X new lines?
| Code: |
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
}
|
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Sat Apr 15, 2006 4:16 am Post subject: |
|
|
| Code: | 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. |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 8:04 am Post subject: |
|
|
will u please tell me how can i define a singel channel??
| DragnLord wrote: | | Code: | 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. |
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Sat Apr 15, 2006 8:23 am Post subject: |
|
|
Change
| Code: | | bind pubm - * cmd:log |
to
| Code: | | bind pubm - "#chan *" cmd:log |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 9:55 am Post subject: |
|
|
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 ?? _________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sun Apr 16, 2006 5:34 am Post subject: |
|
|
is there any way to save tha log to a remote ftp folder?? _________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
|