PoplarYang
3/26/2019 - 4:19 PM

常用函数

# $1 输出的颜色
# $2 输出的内容
function echo_color() {
    case $1 in
        "red" )
            echo -e "\e[31;40m$2\e[0m"
            ;;
        "fail" )
            echo -e "\e[31;40m$2\e[0m"
            ;;
        "green")
            echo -e "\e[32;40m$2\e[0m"
            ;;
        "success")
            echo -e "\e[32;40m$2\e[0m"
            ;;
        "yello")
            echo -e "\e[33;4m$2\e[0m"
            ;;
        "info")
            echo -e "\e[33;4m$2\e[0m"
            ;;
        *)
            echo "$2"
    esac
}
function check_status() {
    local app_name=$1
    local app_port=$2
    app_port_c=$(ss -antu | grep -c $app_port)
    app_name_c=$(ps -ef | grep $app_name | grep -vc grep)
    echo 
}