转至:https://blog.csdn.net/weixin_40816738/article/details/105244851

① 脚本编写
创建脚本

vim closeFirewall.sh

添加脚本内容如下:

if egrep "7.[0-9]" /etc/redhat-release &>/dev/null;then

  systemctl stop firewalld

   systemctl disable firewalld

elif

  egrep "6.[0-9]" /etc/redhat-release &>/dev/null; then

   service iptables stop

   chkconfig iptables off

fi

保存退出:wq

② 运行脚本

chmod u+x closeFirewall.sh

./closeFirewall.sh

或者

bash closeFirewall.sh

③ 脚本内容简述

这是一个centos7和centos6 2个版本防火墙脚本
先去查看/etc/redhat-release文件中的系统版本内容,然后用正则表达式区配7.x还是6.x,然后使用管道命令过滤,最后,针对不同系统走不同分支

最新文章

  1. Array的个人总结
  2. [poj2492]A Bug's Life(并查集+补集)
  3. jQuery立体式数字动态增加(animate方法)
  4. 1.6 基础知识——GP2.5 培训(Training)
  5. jquery过滤器之:contains()、.filter()
  6. MongoDB快速上手
  7. ajax“显示弹窗详情”和“删除”功能练习
  8. ACM进阶
  9. CentOS6.4x64安装mysql5.6.23(rpm)
  10. OC 获取城市首字母
  11. 初探Java8中的HashMap(转)
  12. 通过EA导入数据库存在表结构并生成文档
  13. jQuery跳房子插件hopscotch
  14. Ubuntu 下安装 nfs
  15. Spring事务操作介绍
  16. java访问mysql数据库
  17. vue v-for的数组改变导致页面不渲染解决方法
  18. tensorflow world language model
  19. 【转】]Android实现开机自动运行程序
  20. 【CF687D】Dividing Kingdom II 线段树+并查集

热门文章

  1. P1518 [USACO2.4]两只塔姆沃斯牛 The Tamworth Two
  2. [转载]Python 资源大全中文版
  3. golang中匿名函数的应用-回调函数-闭包
  4. python3爬虫超简单实例
  5. Excel与MySQL数据库的导入与导出
  6. [数据结构]伸展树(Splay)
  7. https的页面内嵌入http页面报错的问题
  8. Go 记录一次groutine通信与context控制
  9. B/S与C/S
  10. Window 共享内存