zoukankan      html  css  js  c++  java
  • 常用代码合集

    目录

    shell

    这是平时我在shell开发中常用的一些代码demo

    1. 注册成为service
    [Unit]
    Description=lingouu-app.service
    After=syslog.target
    
    [Service]
    Type=simple
    ExecStart=/usr/bin/java -jar /developer/package/lingouu-app-api.jar
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
    
    1. sh文件
    #!bin/bash
    echo "exec......"
    systemctl stop lingouu-app
    DATE=$(date +%Y%m%d)
    export JAVA_HOME PATH CLASSPATH
    PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
    CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$CLASSPATH
    DIR=/developer/package
    JARFILE=lingouu-app-api.jar
    if [ ! -d $DIR/backup ];then
       mkdir -p $DIR/backup
    fi
    cd $DIR
    if [  -f $DIR/$JARFILE ];then
          mv $JARFILE backup/$DATE_$JARFILE.back
    fi
    mv $DIR/temp/$JARFILE $DIR/$JARFILE
    echo "starting......"
    systemctl start lingouu-app
    
    1. nginx自定义配置
    upstream web_api_old {
        server 172.19.8.xxx:8090 weight=2 max_fails=3 fail_timeout=15 max_conns=1000;
        server 172.19.8.xxx:8090 weight=2 max_fails=3 fail_timeout=15 max_conns=1000;
    }
    
    server {
        listen 80;
        autoindex on;
        server_name xxx.com;
        #access_log /etc/nginx/logs/access.log combined;
           access_log off;
        index index.html index.htm index.jsp index.php;
           #开启gzip
           gzip on;
           gzip_disable "msie6";
    
           gzip_vary on;
           gzip_proxied any;
           gzip_comp_level 6;
           gzip_buffers 16 8k;
           gzip_http_version 1.1;
           gzip_min_length 256;
           gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
    
        if ( $query_string ~* ".*[;'<>].*" ){
            return 404;
        }
           location / {
            alias /developer/web/lingouu-pc/;
            try_files $uri $uri/ /index.html;
            expires  1d;
            index index.html;
            
        }
    
       location /web/ {
            proxy_pass http://web_api_old;
            client_max_body_size    1000m;
    	proxy_set_header Host $host; 
            #add_header Access-Control-Allow-Origin *;
    	proxy_set_header X-Real-IP $remote_addr;
    	proxy_set_header X-Real-Port $remote_port;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       }
    }
    
    
  • 相关阅读:
    单例模式
    C++继承-重载-多态-虚函数
    c++仿函数 functor
    常用排序算法实现与效率比较
    树的中序非递归遍历
    二叉树递归遍历
    队列的顺序存储框架
    栈的链式存储框架
    栈的顺序存储构架
    函数指针和回调函数
  • 原文地址:https://www.cnblogs.com/cl-rr/p/11997655.html
Copyright © 2011-2022 走看看