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

  • 相关阅读:
    Java中的变量
    Java是什么
    leetcode 75. 颜色分类
    leetcode 283. 移动零
    剑指 Offer 65. 不用加减乘除做加法
    剑指 Offer 53
    剑指 Offer 58
    剑指 Offer 58
    剑指 Offer 57
    剑指 Offer 57. 和为s的两个数字
  • 原文地址:https://www.cnblogs.com/hrers/p/12760565.html
Copyright © 2011-2022 走看看