• shell backup


    shell backup




    テスト用shell

    #!/bin/bash
    echo shell start

    # 入力パラメータ:URL
    api_url=$1

    # 入力パラメータよってURL生成
    rootpath=http://10.19.69.50:8080/test
    tokenid=S3TZLVN5MSKF5wi17KwC

    echo $1
    echo "$1"

    if [ "$1" == "doukikaOnlyDiff" ]
    then
    api_url=$rootpath/batch/evaluation/execute/1?tokenId=$tokenid
    else
    api_url=$1
    fi

    echo "api_url=$api_url"

    echo shell end







    APIの呼出

    #!/bin/bash
    echo shell start

    # ログのパス
    log_dir=/sb/logs/kwc/scripts

    if [ ! -d $log_dir ]; then
    mkdir -p $log_dir
    fi

    # ログのフルパス
    path_log=$log_dir/official_faq_callApi_`date '+%Y%m%d'`.log

    # 入力パラメータ:URL
    api_url=$1

    # 入力パラメータよってURL生成
    rootpath=http://10.157.99.52:8080/batch
    tokenid=S3TZLVN5MSKF5wi17KwC

    # case1、コンテンツ評価バッチ
    if [ "$1" == "evaluation_execute" ]; then
    api_url=$rootpath/faqAPI/batch/evaluation/execute/1?tokenId=$tokenid
    fi
    # case2、いいね保守バッチ(一年以上のフィードバックデータ削除処理)
    if [ "$1" == "delete1yBefore" ]; then
    api_url=$rootpath/batch/Feedback/delete1yBefore/1?tokenId=$tokenid
    fi
    # case3、DFSデータ同期化(未同期化部分だけ同期化する)
    if [ "$1" == "doukikaOnlyDiff" ]; then
    api_url=$rootpath/batch/dfs/doukikaOnlyDiff/1?tokenId=$tokenid
    fi
    echo "api_url=$api_url"

    # 実行結果判断用
    result_code="resultCd"

    echo -e 【`date +"%Y/%m/%d %H:%M:%S"`】 "********************************************** 処理開始 **********************************************" >>$path_log 2>&1
    echo -e "api_url=$api_url" >> $path_log 2>&1

    if [ ! -n "$api_url" ]; then
    echo url not null
    echo -e "url not null" >> $path_log
    else
    #get http response
    echo "URL=$api_url"
    http_result=$(curl -s $api_url)
    echo -e "$http_result" >> $path_log
    if [[ $http_result =~ $result_code ]]
    then
    result_code=${http_result:13:1}
    if [ $result_code -eq 0 ]; then
    echo Execute sucess
    echo -e Execute sucess >> $path_log
    else
    echo Execute failed
    echo -e Execute failed >> $path_log
    fi
    else
    echo URL is wrong
    echo -e 入力パラメータURL不正 >> $path_log
    fi
    fi

    echo -e 【`date "+%Y/%m/%d %H:%M:%S"`】 "********************************************** 処理終了 **********************************************" >>$path_log 2>&1
    echo shell end




    削除用

    #!/bin/bash

    ##### define field
    shell_name=official_faq_intelligentsearch_postCapture.sh

    # ログのパス
    log_dir=/sb/logs/kwc/scripts

    if [ ! -d $log_dir ]; then
    mkdir -p $log_dir
    fi

    # ログのフルパス
    log_file=$log_dir/official_faq_intelligentsearch_postCapture_`date '+%Y%m%d'`.log

    # 作業ディレクトリ
    target_dir=/sb/logs/intelligentSearch

    # 対象ファイル
    target_file=$target_dir/intelligentSearch-is.log

    echo 【`date "+%Y/%m/%d %H:%M:%S"`】********************************************** 処理開始 ********************************************** >>$log_file 2>&1

    # 対象ファイルが存在すれば、削除する
    if [ -f $target_file ]; then
    echo "削除作業開始" >>$log_file 2>&1
    echo "削除ファイル: ${target_file}" >>$log_file 2>&1

    rm -f $target_file

    echo "削除作業終了" >>$log_file 2>&1
    else
    echo "削除ファイル「${target_file}」がないため、削除作業をスキップします" >>$log_file 2>&1
    fi

    echo 【`date "+%Y/%m/%d %H:%M:%S"`】********************************************** 処理終了 ********************************************** >>$log_file 2>&1
    exit 0




    コピー用

    #!/bin/bash

    ##### define field
    shell_name=official_faq_intelligentsearch_preCapture.sh

    # ログのパス
    log_dir=/sb/logs/kwc/scripts

    if [ ! -d $log_dir ]; then
    mkdir -p $log_dir
    fi

    # ログのフルパス
    log_file=$log_dir/official_faq_intelligentsearch_preCapture_`date '+%Y%m%d'`.log

    # 作業ディレクトリ
    target_dir=/sb/logs/intelligentSearch

    # コピー元ファイル
    pre_file=$target_dir/intelligentSearch.log.`date '+%Y-%m-%d' --date '1 day ago'`

    # コピー後ファイル
    post_file=$target_dir/intelligentSearch-is.log

    echo 【`date "+%Y/%m/%d %H:%M:%S"`】********************************************** 処理開始 ********************************************** >>$log_file 2>&1

    # コピー後ファイルが存在すれば、削除する
    if [ -f $post_file ]; then
    echo "コピー後ファイル「${post_file}」が存在する為、削除する" >>$log_file 2>&1
    rm -f $post_file
    fi
    echo "コピー作業開始" >>$log_file 2>&1
    echo "コピー前ファイル: ${pre_file}" >>$log_file 2>&1
    echo "コピー後ファイル: ${post_file}" >>$log_file 2>&1

    cp -f $pre_file $post_file

    echo "コピー作業終了" >>$log_file 2>&1

    echo 【`date "+%Y/%m/%d %H:%M:%S"`】********************************************** 処理終了 ********************************************** >>$log_file 2>&1
    exit 0




  • 相关阅读:
    http状态码
    闭包
    节流和防抖
    继承方式
    array和object对比
    排序算法
    算法题
    汇编 asm 笔记
    FFMPEG 内部 YUV444P016 -> P010
    FFMPEG 内部 YUV444p16LE-> P016LE
  • 原文地址:https://www.cnblogs.com/taobr/p/11756796.html
Copyright © 2020-2023  润新知