egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mysql server gone away

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Wed Sep 15, 2010 7:06 am    Post subject: mysql server gone away Reply with quote

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
Back to top
View user's profile Send private message
thommey
Halfop


Joined: 01 Apr 2008
Posts: 73

PostPosted: Wed Sep 15, 2010 7:56 am    Post subject: Reply with quote

Let your mysql database handle be in the global $dbhandle variable.
Code:

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.
Back to top
View user's profile Send private message
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Thu Sep 16, 2010 6:30 am    Post subject: Reply with quote

ahhh it was easy Razz thanks for great help Wink
_________________

You need a iRC bot for your CS Gameserver? Rent one here
Back to top
View user's profile Send private message
ultralord
Master


Joined: 06 Nov 2006
Posts: 255

PostPosted: Fri Sep 17, 2010 10:19 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
thommey
Halfop


Joined: 01 Apr 2008
Posts: 73

PostPosted: Fri Sep 17, 2010 6:13 pm    Post subject: Reply with quote

woops, sorry, should've been:
Code:

bind time - * checksqlalive
proc checksqlalive {args} {
  mysql::ping $::dbhandle
}
Back to top
View user's profile Send private message
kenh83
Halfop


Joined: 08 Sep 2010
Posts: 61

PostPosted: Fri Feb 04, 2011 1:39 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber