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

  • 相关阅读:
    Windows 8/8.1/10 加载动画WPF实现
    WPF
    NAT类型判断
    Visual Studio插件: SlowCheetah
    EF6连接MySQL若干问题汇总
    javascript 继承
    docker安装宝塔
    协同推荐算法-php实现
    大文件传输解决方案:分片上传 / 下载限速
    WEB 防止CSRF攻击
  • 原文地址:https://www.cnblogs.com/hrers/p/12760565.html
Copyright © 2011-2022 走看看