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 Looping/Timer Help Please

Old posts that have not been replied to for several years.
Locked
x
xolite

Need Looping/Timer Help Please

Post by xolite »

What i am trying to do is If the site URL has the text , display every x time the site is down, when the page does not have the text , display the site is back to normal and then only check if the site goes to maintainence ( with out displaying ) then if the site goes down , loop again that the site is down until it comes back and so on and so forth... sorry i am new to TCL as i am sure you can quickly tell

package require http


#bind pub - !status pub:neo_check
#bind time - "15 * * * *" pub:neo_check

#bind pubm - "*" pub:neo_check

proc pub:neo_check {nick host handle chan text} {
global botnick showtimechans


#set statx [http::geturl http://www.neopets.com/objects.phtml]
set statx [http::geturl http://www.dubloon.com/test.php]

set data [http::data $statx]

set var "<font size=5>Neopets is down for maintenance :(</font>"
set x 0
foreach content [split $data \n] {
if [string match "*$var*" $content] {set x 1}
}

if {$x == 1} {
putserv "NOTICE Xolite : \002 *Neopian Alert: http://www.Neopets.com is Down For Maintenance :(\002"
putlog "Neopets.com Status is Down For Maintenance"

} else {

if {$x == 0} {
putserv "NOTICE Xolite :\002 *Attention Neopians: http://www.Neopets.com/ Is Back Up and Running\002 - Have Fun!"
putlog "Neopets.com Status is OK"
return 0

}
}


timer 1 pub:neo_check
return 1

}
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

you forgot to tell us which part of the code you can't get to work ;)
anyway..
remove the return x, no need for those
make sure you add a http::cleanup $statx right after the set data line
make the matching case-insensitive
to tell you how to get the timer right we need to know how you intend to trigger the proc
Elen sila lúmenn' omentielvo
Locked