标签:
#!/bin/sh SVN_USER_NAME= SVN_PASSWORD= ROOT_PATH=$1 PROJECT_NAME=$2 ACTION=$3 SVN_LIB_ROOT=$4 USER_ACCOUNT=$5 PASSWORD=$6 HOST=$7 PORT=$8 COMMAND=$9 netty_common=‘netty-common‘ netty_common_server=‘netty-common-server‘ netty_common_client=‘netty-common-client‘ netty_chat_common=‘netty-chat-common‘ tip () { echo "usage: deploy_base.sh ROOT_PATH PROJECT_NAME ACTION SVN_LIB_ROOT USER_ACCOUNT PASSWORD HOST COMMAND" } #update_src () { #if [ -d $1 ]; then #cd $1 #svn update #else #svn co svn://svn.iweju.com/yueba/server/src/branches/trunk_taiwang/$1 --username $2 --password $3 $1 #cd $1 #fi #} mvn_pkg(){ mvn package } mvn_install(){ mvn install } update_lib () { path="$1-lib" if [ -d $path ]; then cd $path svn update else svn co $4/$1/lib --username $2 --password $3 $path cd $path fi } cp_lib () { cp target/lib/*.jar "$1-lib" cp target/*.jar "$1-lib" } commit_lib () { cd "$1-lib" svn add *.jar svn commit -m "package & deploy $1" } restart(){ auto_login_ssh $1 $2@$3 $4 $COMMAND } auto_login_ssh () { expect -c "set timeout -1; spawn -noecho ssh -p $3 -o StrictHostKeyChecking=no $2 ${@:4}; expect *assword:*; send -- $1\r; interact;"; } if [ $# -lt 8 ];then tip exit 0; fi case "$ACTION" in restart) restart $PASSWORD $USER_ACCOUNT $HOST $PORT ;; deploy | deploy_delete) cd $ROOT_PATH if [ -d "../$netty_common/" ];then cd ../$netty_common/ mvn_install fi if [ -d "../$netty_common_server/" ];then cd ../$netty_common_server/ mvn_install fi if [ -d "../$netty_common_client/" ];then cd ../$netty_common_client/ mvn_install fi if [ -d "../$netty_chat_common/" ];then cd ../$netty_chat_common/ mvn_install fi if [ -d "../$netty_common/" ];then cd ../$PROJECT_NAME/ fi mvn_pkg update_lib $PROJECT_NAME $SVN_USER_NAME $SVN_PASSWORD $SVN_LIB_ROOT cd ../ cp_lib $PROJECT_NAME commit_lib $PROJECT_NAME cd ../ restart $PASSWORD $USER_ACCOUNT $HOST $PORT ;; *) tip esac exit 1
标签:
原文地址:http://www.cnblogs.com/super-d2/p/4391363.html