MySql status shell script

By | 2012-10-24

ref.: http://www.linuxquestions.org/questions/linux-newbie-8/shell-script-to-check-whether-mysql-server-is-running-or-not-721940/

#!/bin/sh
if [[ -z `service mysqld status | grep running ` ]]
then
echo 0
else
echo 1
fi

Leave a Reply

Your email address will not be published. Required fields are marked *