diff --git a/检测服务是否关闭.txt b/检测服务是否关闭.txt new file mode 100644 index 0000000..e79ed2d --- /dev/null +++ b/检测服务是否关闭.txt @@ -0,0 +1,16 @@ +#!/usr/bin/bash +#检查服务是否关闭 +#by fuxiaoshun 3/29 + +read -p "请输入服务名:" name + +ss -tnlp | grep $name &>/dev/null + +if [ $? -eq 0 ];then + + echo "服务已经启动" + else + yum -y install $name &>/dev/null + systemctl restart $name + echo "$name 重新启动成功" +fi \ No newline at end of file