• 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

  • 相关阅读:
    Python MongoDB使用介绍
    算法网站
    无限级树状图css实现
    无限级别分类嵌套格式抓取
    无限级别分类
    计算多维数组到底是几维的
    获取无限级别分类
    mysql 重启
    radio 控制器function用法
    php-fpm 重启 nginx单独配置 重启
  • 原文地址:https://www.cnblogs.com/hrers/p/12760565.html
Copyright © 2020-2023  润新知