Shell脚本判断服务是否启动(systemctl、service服务是否启动)

#!/bin/bash

function is_service(){
    result=`service mysql status`
    if [[ $result =~ "(dead)" ]];then
        echo "[-] Mysql have not started"
        exit
    fi
}

function main(){
    is_service
}


main

猜你喜欢

转载自blog.csdn.net/u012206617/article/details/125297642
今日推荐