zoukankan      html  css  js  c++  java
  • 服务管理脚本

    测试后,逻辑通过验证的代码:

    BEEF_PID=1
    MITM_PID=1
    LOG_PID=1
    
    TESTING(){
            if [ $1 -eq 0 ];then
                    echo "SUCCESS"
            else
                    echo "ERROR"
            fi
    }
    
    PID_STATUS(){
            if [ ! -n "$1" ];then
                    echo "is_NULL"
                    return 45
            else
                    echo "not_NULL"
                    return 0
            fi
    }
    
    PID_STATUS $MITM_PID
    num=$?
    if [ $num -eq 0 ];then
            echo "already"
    else
            ls
            TESTING $?
    fi
    

      待修改的脚本

    MITM_PID=$(pgrep -f mitm)
    GET_PID=$(pgrep -f getmac)
    LOG_PID=$(pgrep -f logprocessing)
    TESTING(){
            PID_STATUS=$1
            if [ $PID_STATUS -eq 0 ];then
                    echo "SUCCESS"
            else
                    echo "ERROR"
                    exit 1
            fi
    }
    
    #
    #if [ ! -n "$MITM_PID" ];then
    #       echo "is NULL";
    #else
    #       echo "not NULL";
    #fi
    
    
    for i in {"$MITM_PID","$GET_PID","$LOG_PID"}
    do
        if [ ! -n "$i" ];then
            echo "is NULL";
        else
            echo "not NULL";
        fi
    done
    
    case $1 in
        start)
            #echo $1
            #ruby /usr/share/beef-xss/beef -v
            #true
            TESTING $?
            #mitmdump -s /usr/share/beef-xss/mitm.py -m transparent
            #true
            /bin/sh /root/22.sh
            TESTING $?
            #python3 /home/code/logprocessing.py
            #true
            /bin/sh /root/33.sh
            TESTING $?
            ;;
        stop)
            #echo $1
            #kill -9 ${BEEF_PID}
            true
            TESTING $?
            #kill -9 ${MITM_PID}
            true
            TESTING $?
            #kill -9 ${LOG_PID}
            true
            TESTING $?
            ;;
        reload)
            echo $1
            ;;
        *)
            echo "USAGE:$0{start|stop|reload}"
    esac
    

      

    for i in {"$MITM_PID","$GET_PID","$LOG_PID"}
    do
    	if [ ! -n "$i" ];then
    		echo "is NULL";
    	else
    		echo "not NULL";
    	fi
    done
    

      

  • 相关阅读:
    使用rem,动态设置root font size
    手机陀螺仪
    获取图片
    插件整理
    jquery图片懒加载
    关于underscore.js
    PCA
    Endnote9
    实验问题记录
    DN/TOA/SR
  • 原文地址:https://www.cnblogs.com/linuxws/p/11053962.html
Copyright © 2011-2022 走看看