zoukankan      html  css  js  c++  java
  • iptables恢复脚本

    #!/bin/bash


    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
    ACTIVE=`systemctl status iptables.service |grep 'active' |awk '{print $2}'`
    INACTIVE=`systemctl status iptables.service |grep 'inactive' |awk '{print $2}'`
    Date=`date +%Y-%m-%d-%H-%M`
    if [ $ACTIVE = "active" ];then
    iptables-restore </root/iptables.restore
    echo "restore success!">/tmp/restore.log
    mail -s "iptables status $Date" wd.zhao@qq.com</tmp/restore.log >/dev/null 2>&1
    elif [ $INACTIVE = "inactive" ];then
    systemctl restart iptables.service
    STATUS1=`systemctl status iptables.service |grep 'active' |awk '{print $2}'`
    STATUS2==`systemctl status iptables.service |grep 'inactive' |awk '{print $2}'`
    if [ $STATUS1 = "active" ];then
    iptables-restore </root/iptables.restore
    echo "restore success!">/tmp/restore.log
    mail -s "iptables status $Date" wd.zhao@qq.com</tmp/restore.log >/dev/null 2>&1
    elif [ $STATUS2 = "inactive" ];then
    echo "iptables is bad!please check it." >>/tmp/iptables.log
    mail -s "iptables status $Date" wd.zhao@qq.com</tmp/iptables.log >/dev/null 2>&1
    fi
    else
    echo "please check out iptables message.Is it installed?">>/tmp/iptables.log
    fi

  • 相关阅读:
    SSM整合
    SpringMVC学习笔记
    Spring笔记
    Spring之AOP在XML中的配置方法
    Spring之AOP的注解配置
    Mybatis学习笔记
    css学习笔记
    DOM技术
    Javascript学习笔记
    Hive导出复杂数据到csv文件
  • 原文地址:https://www.cnblogs.com/hrers/p/12760565.html
Copyright © 2011-2022 走看看