Linux Shell脚本_关闭防火墙
生活随笔
收集整理的這篇文章主要介紹了
Linux Shell脚本_关闭防火墙
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
① 腳本編寫
創建腳本
添加腳本內容如下:
if egrep "7.[0-9]" /etc/redhat-release &>/dev/null; thensystemctl stop firewalldsystemctl disable firewalld elif egrep "6.[0-9]" /etc/redhat-release &>/dev/null; thenservice iptables stopchkconfig iptables off fi保存退出:wq
② 運行腳本
③ 腳本內容簡述
這是一個centos7和centos6 2個版本防火墻腳本 先去查看/etc/redhat-release文件中的系統版本內容,然后用正則表達式區配7.x還是6.x,然后使用管道命令過濾,最后,針對不同系統走不同分支總結
以上是生活随笔為你收集整理的Linux Shell脚本_关闭防火墙的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Springboot/Cloud集成Se
- 下一篇: RabbitMQ集群原理介绍