“Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra” Réponses codées

Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra

#!/bin/bash
if [[ ! "$(/usr/sbin/service mysql status)" =~ "start/running" ]]
then
    /usr/sbin/service mysql start
fi
Jealous Jellyfish

Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra

#!/bin/bash

# Check if MySQL is running
sudo service mysql status > /dev/null 2>&1

# Restart the MySQL service if it's not running.
if [ $? != 0 ]; then
    echo -e "MySQL Service was down. Restarting now...\n"
    sudo service mysql restart
else
    echo -e "MySQL Service is running already. Nothing to do here.\n"
fi
Jealous Jellyfish

Réponses similaires à “Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra”

Questions similaires à “Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra”

Plus de réponses similaires à “Écrivez un script Ubuntu qui démarrera le service MySQL chaque fois qu'il descendra” dans Sql

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code