Bash init.d script detect that mysqld has started and is running

Posted by Ricket on Stack Overflow See other posts from Stack Overflow or by Ricket
Published on 2010-03-14T04:03:15Z Indexed on 2010/03/14 4:05 UTC
Read the original article Hit count: 195

Filed under:
|

I'm working on my dedicated server running CentOS. I found out that one of my applications which starts up via a script in /etc/init.d/ requires MySQL to be running, or else it throws an error, so essentially I currently have to start it by hand.

How can I detect, in a bash script (#!/bin/sh), whether the MySQL service has started yet? Is there some way to poll port 3306 until it is open to accept connections, and only then continue with the script? Or maybe set an order so that the script doesn't run until the mysqld script runs?

© Stack Overflow or respective owner

Related posts about bash

Related posts about mysql