Page 1 of 1

Creating a Stay Alive Script for MySQL

New postPosted: Thu Mar 27, 2008 10:51 pm
by Ranman
Code: [Select all] [Expand/Collapse] [Download] (Untitled)
# Create a file called stay_alive-mysql containing the following lines:
#!/bin/sh
#
# Stay alive crontab script:
#
if !(ps -u mysql | grep safe_mysqld); then
/path/to/bin/safe_mysqld --user=mysql --log --log-update=mybackupmethod &
fi

# At your command line prompt type:
crontab -e

# Add these two lines:
# Lets check every 20 minutes that MySQL running.
*/20 * * * *    /path/to/the/stay_alive-mysql 1> /dev/null 2> /dev/null