PorkChup
12-23-2003, 05:31 PM
Anyone have a script that I can set to cron to restart mysql if the process dies? My MySQL has been crashing a lot lately (I'm wondering if it's time to upgrade).
Also, my server has 3.23. Could someone quickly list the commands I need to download the 4.0 rpms to upgrade? Is there a way to revert if something bad happens?
Dacsoft
12-23-2003, 07:29 PM
Check out http://www.rfxnetworks.com/sim.php
Set this to cron for 1 minute.
#!/bin/bash
#
# Startup script for checking status of mysqld
#
if [ -f /var/run/mysqld/mysqld.pid ] ; then
echo "Mysqld running fine"
else
/etc/rc.d/init.d/mysqld restart
fi
apollo
12-24-2003, 05:52 PM
depending on your version, have a look at mysql.com documentation section.... I have included a simple link fo ryour reference..
http://www.mysql.com/doc/en/Upgrading-from-4.0.html
Arvand
12-25-2003, 12:20 AM
To keep it up (restart when it crashes) I think chkservd will do the job. It comes with Cpanel already so I havent actually installed it myself but through a search on google it maybe part of the mpitch application. Search for mpitch on rpmfind.net?
To upgrade to 4... I am not sure if this will preserve all your databases but the easiest way is to get apt-get (from freshrpms.net - there is a tutorial on the front page) and then use apt-get install mysql to upgrade to latest.
PorkChup
12-26-2003, 12:40 AM
SIM has turned out to be great, but nipl's script is also very useful.
Here's the challenge - what if mysqld hangs:
1) The pid file is no longer there BUT
2) mysqld has active process(es) using ps -ax AND
3) service mysqld stop/restart FAILS
The only way I'm able to solve this problem is to run kill -9 mysqlpid, but I can't put this into a script because the pid given by ps -ax changes.
kickmybutt
12-26-2003, 01:35 AM
I have the same problem. I have been searching high and low as to what is causing the issue. MySQL dies without any signs, but chkservd cant get it back up. I think just changing the chkservd file for MySQL and what it calls, that will get it corrected so that auto restarts (automagically) can get MySQL going again without any intervention on my part.