检测nginx是否运行

#!/bin/bash
status=$(systemctl is-active nginx)
if [ "$status" == "active" ]; then
    echo "nginx is running";
else
    echo "nginx is not running";
    systemctl start nginx;
fi

没有运行运行命令开始运行

分类: shell 标签: 暂无标签

评论

暂无评论数据

暂无评论数据

目录