Linux Shell脚本_关闭防火墙
2024-09-07 17:07:29
转至: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,然后使用管道命令过滤,最后,针对不同系统走不同分支
最新文章
- Array的个人总结
- [poj2492]A Bug's Life(并查集+补集)
- jQuery立体式数字动态增加(animate方法)
- 1.6 基础知识——GP2.5 培训(Training)
- jquery过滤器之:contains()、.filter()
- MongoDB快速上手
- ajax“显示弹窗详情”和“删除”功能练习
- ACM进阶
- CentOS6.4x64安装mysql5.6.23(rpm)
- OC 获取城市首字母
- 初探Java8中的HashMap(转)
- 通过EA导入数据库存在表结构并生成文档
- jQuery跳房子插件hopscotch
- Ubuntu 下安装 nfs
- Spring事务操作介绍
- java访问mysql数据库
- vue v-for的数组改变导致页面不渲染解决方法
- tensorflow world language model
- 【转】]Android实现开机自动运行程序
- 【CF687D】Dividing Kingdom II 线段树+并查集