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.
Help for those learning Tcl or writing their own scripts.
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Wed Sep 15, 2010 7:06 am
hello i make my script but days now i have that problem when i run the proc sometimes not always it says on telnet
::mysql::sel/db server: MySQL server has gone away
after .rehash is working of course does anyone now how i can fix it.. or make .rehash if that problem appear?
You need a iRC bot for your CS Gameserver? Rent one
here
thommey
Halfop
Posts: 76 Joined: Tue Apr 01, 2008 2:59 pm
Post
by thommey » Wed Sep 15, 2010 7:56 am
Let your mysql database handle be in the global $dbhandle variable.
Code: Select all
bind time - * checksqlalive
proc checksqlalive {} {
mysql::ping $::dbhandle
}
That will not only check if the connection is alive every minute but also automatically reconnect if it timed out. (Alternatively, do that before every sql statement you execute). See also
mysql reference manual .
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Thu Sep 16, 2010 6:30 am
ahhh it was easy
thanks for great help
You need a iRC bot for your CS Gameserver? Rent one
here
ultralord
Master
Posts: 255 Joined: Mon Nov 06, 2006 6:52 pm
Post
by ultralord » Fri Sep 17, 2010 10:19 am
cant find the correct args
Tcl error [checksqlalive]: wrong # args: should be "checksqlalive"
:S
You need a iRC bot for your CS Gameserver? Rent one
here
thommey
Halfop
Posts: 76 Joined: Tue Apr 01, 2008 2:59 pm
Post
by thommey » Fri Sep 17, 2010 6:13 pm
woops, sorry, should've been:
Code: Select all
bind time - * checksqlalive
proc checksqlalive {args} {
mysql::ping $::dbhandle
}
kenh83
Halfop
Posts: 61 Joined: Wed Sep 08, 2010 11:22 am
Post
by kenh83 » Fri Feb 04, 2011 1:39 pm
thommey ..
The checksqlalive snipplet, can you expand on it so that if it returns 1, it does nothing, if it returns NOTHING it would restart the mysql server.