注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

Computer Science

I Pressed My Words Here. Will You Read ?

 
 
 

日志

 
 

call java interface : call_interface.sh  

2017-03-01 10:39:14|  分类: My Projects |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
./call_interface.sh:
#!/bin/bash
# author: will
# createTime: 201606241238
_help(){
                                echo "Call the Interface of cs backbone with authority.";
                                echo "-l, --folderPath:         represent the the folder path of the jar file.";
                                echo "                          exp. /cs/java/csBBExtInterfaceCallerWithAuthority/";
                                echo "-i, --fileName:           represent the the file name of the jar file.";
                                echo "                          exp. cs-biz-authority-1.0-SNAPSHOT.jar";
                                echo "-o, --origin:             represent the the origin of the url to post.";
                                echo "                          exp. http://localhost:8080/";
                                echo "-n, --siteName:           represent the the site name of the url to post.";
                                echo "                          exp. manage/";
                                echo "-p, --pathName:           represent the the path name of the url to post.";
                                echo "                          exp. authority/inner-authority!syncDateTime.do";
                                echo "-s, --search:             represent the the search of the url to post.";
                                echo "                          exp. ?username=&password=&snbid=123";
                                echo "then the url will be http://localhost:8080/manage/authority/inner-authority!syncDateTime.do?snbid=123";
                                echo "Example:";
                                echo "bash call_interface -o http://localhost:8080/ -n manage/ -p 'authority/inner-authority!syncDateTime.do' -s '?username=&password=&snbid=123'";
                                echo "OR call it from tomcat:";
                                echo "/cs/script/bash/call_interface.sh -l /cs/tomcat-cs-backbone/webapps/csBBExt/WEB-INF/lib/ -o http://172.30.236.84/ -n csBBExt/ -p 'api/internet-bar-version-api!findVersion.do' -s '?snbid=123'";
                                echo "OR call it from jars folder:";
                                echo "/cs/script/bash/call_interface.sh -l /cs/java/csBBExtInterfaceCallerWithAuthority -o http://172.30.236.84/ -n csBBExt/ -p 'api/internet-bar-version-api!findVersion.do' -s '?snbid=123'";
}

call_interface(){
        local path=$(cd `dirname $PWD/$0`;pwd);
        local fileName="cs-biz-authority-1.0-SNAPSHOT.jar";
        local folderPath=${path};
        #local webapps="${path}/../webapps";
        #local action=${1};
        #local folderName="ROOT";
        #local paramOne=${2}
        #local explanation=${3};
        #local moreExplanation=${4};
        #echo "${@:2}";
        #case "${action}" in
        #       "forceshutdown") forceshutdown ${@:2} ;;
        #       "removeFolder") removeFolder ${@:2} ;;
        #       "startwithlog") startwithlog ${@:2} ;;
        #       "cpLinkFile") cpLinkFile ${@:2} ;;
        #       "t") t ${@:2} ;;
        #       *) echo "forceshutdown/removeFolder/startwithlog/cpLinkFile/t"
        #esac
        local origin=""
        local siteName=""
        local pathName=""
        local search=""
        if test $# -lt 1; then
                _help $@;
                exit 1;
        fi
        echo "#################";
        echo "#RECIVING PARAMS";
        while test $# -gt 0; do
                case "$1" in
                        -h|--help)
                                _help $@;
                                ;;
                        -l|--folderPath)
                                shift
                                if test $# -gt 0; then
                                        echo "${1}";
                                        folderPath="${1}"
                                else
                                        echo "no folderPath specified for jar file";
                                        exit 1;
                                fi
                                shift
                                ;;
                        -i|--fileName)
                                shift
                                if test $# -gt 0; then
                                        echo "${1}";
                                        fileName="${1}"
                                else
                                        echo "no fileName specified for jar file";
                                        exit 1;
                                fi
                                shift
                                ;;
                        -o|--origin)
                                shift
                                if test $# -gt 0; then
                                        echo "${1}"
                                        origin="${1}"
                                else
                                        echo "no origin specified for url"
                                        exit 1
                                fi
                                shift
                                ;;
                        -n|--siteName)
                                shift
                                if test $# -gt 0; then
                                        echo "${1}"
                                        siteName="${1}"
                                else
                                        echo "no siteName specified for url"
                                        exit 1
                                fi
                                shift
                                ;;
                        -p|--pathName)
                                shift
                                if test $# -gt 0; then
                                        echo "${1}";
                                        pathName="${1}"
                                else
                                        echo "no pathName specified for url";
                                        exit 1;
                                fi
                                shift
                                ;;
                        -s|--search)
                                shift
                                if test $# -gt 0;then
                                        echo "${1}";
                                        search="${1}"
                                else
                                        echo "no search specified for url";
                                        exit 1;
                                fi
                                shift
                                ;;
                esac
        done
        echo "#################";
        echo "#CHECKING ENV";
        if [ "${JRE_HOME}" == "" ]; then
                echo -n "JAVA_HOME:"
                echo "${JAVA_HOME}"
                export JRE_HOME=${JAVA_HOME}/jre
                echo -n "JRE_HOME:"
                echo "${JRE_HOME}"
                export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
                echo -n "CLASSPATH:"
                echo "${CLASSPATH}"
                export PATH=${JAVA_HOME}/bin:$PATH
                echo -n "PATH:"
                echo "${PATH}"
                source /etc/profile
        else
                echo -n "JRE_HOME:"
                echo "${JRE_HOME}"
        fi
        echo "#################";
        echo "#EXECUTE CMD";
        #java -cp E:\svn\csbackbone\web\authorityDependence\cs-biz-authority-1.0-SNAPSHOT.jar;E:\svn\csbackbone\web\authorityDependence\* com.sc.netcs.authority.struts.InnerAuthority "http://localhost:8080/" "manage/" "api/internet-bar-version-api!findVersion.do" "?snbid=123"
        echo "java -cp '${folderPath}/${fileName}:${folderPath}/*' 'com.sc.netcs.authority.struts.InnerAuthority' '${origin}' '${siteName}' '${pathName}' '${search}'";
        java -cp "${folderPath}/${fileName}:${folderPath}/*" "com.sc.netcs.authority.struts.InnerAuthority" "${origin}" "${siteName}" "${pathName}" "${search}"
}
call_interface $@

./call_interface.sh
  评论这张
 
阅读(13)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017