linux shell脚本,检测 服务是否启动,如果启动,将其关闭
时间:2020-04-11 18:31 来源:linux.it.net.cn 作者:IT
#!/bin/bash
name="3:启用"
service1=$(echo `chkconfig --list auditd`|sed 's:\s:/:g'|cut -d / -f 5)
service2=$(echo `chkconfig --list autofs`|sed 's:\s:/:g'|cut -d / -f 5)
if [ $name == $service1 ];then
chkconfig --level 345 auditd off
fi
if [ $name == $service2 ];then
chkconfig --level 345 autofs off
fi
(责任编辑:IT)
#!/bin/bash name="3:启用" service1=$(echo `chkconfig --list auditd`|sed 's:\s:/:g'|cut -d / -f 5) service2=$(echo `chkconfig --list autofs`|sed 's:\s:/:g'|cut -d / -f 5) if [ $name == $service1 ];then chkconfig --level 345 auditd off fi if [ $name == $service2 ];then chkconfig --level 345 autofs off fi (责任编辑:IT) |