rodrigobertin
6/13/2017 - 1:23 PM

Verificar estado de Apache y Mysql

Verificar estado de Apache y Mysql

#!/bin/bash
#---------------- Mysql --------------------------
if [[ ! "$(systemctl is-active mysql.service )" =~ "active" ]]
then
   echo $"Reiniciar MySql"
   sudo systemctl start mysql.service
else
  echo $"Mysql Funcionando"
fi

#---------------- APACHE --------------------------
echo $"--------- Apache -----------"
ps auxw | grep apache2 | grep -v grep > /dev/null
if [ $? != 0 ]
then
        echo $"Reiniciar Apache"
        sudo /etc/init.d/apache2 restart > /dev/null
    else
        echo $"Apache Funcionando"
fi