首页 > 代码库 > windows下部署服务脚本

windows下部署服务脚本

  1 chcp 65001
  2 set home_dir=kp_home
  3 set package_dir=/root/java_source
  4 set config_home=anyDir
  5 set resource_path=/home/Frank/openSource
  6 set exchange_dir=\exchange.90km.com\exchange
  7 set remote_host=192.168.80.84
  8 set login_user=root
  9 set remote_passwd=123456
 10 
 11 rem 1.创建工作目录
 12 if exist %home_dir% (
 13     rd /s /q %home_dir%
 14 )
 15 md %home_dir%
 16 rem 2.进入工作目录
 17 cd %home_dir%
 18 
 19 rem 3.获取pscp工具.
 20 xcopy \%exchange_dir%\xf\pscp.exe
 21 
 22 rem 4.使用pscp下载文件Tomcat.
 23 pscp -l %login_user% -pw %remote_passwd% %remote_host%:/%resource_path%/apache-tomcat-7.0.55.zip .
 24 
 25 md zip
 26 cd zip
 27 rem 5.使用pscp下载文件7zip.
 28 pscp -l %login_user% -pw %remote_passwd% %remote_host%:/%resource_path%/zip/* .
 29 cd ../
 30 
 31 rem 6.下载需要的包.gateway , proxy , gameProxy , kp , gameServer. 先下载proxy和kp
 32 rem 6.1下载kp................
 33 md kp
 34 cd kp
 35 pscp -l %login_user% -pw %remote_passwd% %remote_host%://%package_dir%/kp/dist/kp.war .
 36 
 37 
 38 rem 6.1下载kp_config................
 39 md kp_config
 40 cd kp_config
 41 pscp -l %login_user% -pw %remote_passwd% %remote_host%://root/kpgroup/%config_home%/kp_config/* .
 42 cd ../../
 43 
 44 
 45 rem 6.2下载config_config................
 46 rem md proxy_config
 47 rem cd proxy_config
 48 rem pscp -l %login_user% -pw %remote_passwd% %remote_host%://root/kpgroup/xf/kp_config/* .
 49 rem cd ../
 50 
 51 rem 6.2下载proxy................
 52 md proxy
 53 cd proxy
 54 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%://%package_dir%/proxy/dist/* .
 55 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:/root/kpgroup/%config_home%/proxy_config/startup.bat .
 56 cd lib/
 57 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:%resource_path%/jce.jar .
 58 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:%resource_path%/sunjce_provider.jar .
 59 
 60 cd ../../
 61 
 62 
 63 rem 6.3下载gateway
 64 md gateway
 65 cd gateway
 66 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%://%package_dir%/gateway/dist/* .
 67 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:/root/kpgroup/%config_home%/gateway_config/startup.bat .
 68 rem 6.4创建gateway配置文件目录
 69 md gateway_config
 70 cd gateway_config
 71 rem 替换配置文件
 72 pscp -l %login_user% -pw %remote_passwd% %remote_host%://root/kpgroup/%config_home%/gateway_config/config.properties .
 73 copy config.properties ..\conf\ /y
 74 cd ../../
 75 
 76 
 77 
 78 rem 7.解压Tomcat.
 79 .\zip\7z e -spf apache-tomcat-7.0.55.zip -oTomcat
 80 rem 8.放入指定的文件到Tomcat下.
 81 
 82 cd .\Tomcat\apache-tomcat-7.0.55 83 rd /s /q webapps
 84 md webapps
 85 cd webapps
 86 copy ..\..\..\kp\kp.war . 87 ..\..\..\zip\7z e -spf kp.war -okp
 88 rem 删除原来的包
 89 del kp.war 
 90 
 91 rem 9.替换配置文件
 92 copy ..\..\..\kp\kp_config\application.properties .\kp\WEB-INF\classes\ /y
 93 copy ..\..\..\kp\kp_config\config.properties .\kp\WEB-INF\classes\ /y
 94 cd ..\..\.. 95 
 96 
 97 rem 10.下载缓存
 98 md cache
 99 cd cache
100 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:%resource_path%/memcached-1.4.5-x86.zip .
101 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:%resource_path%/redis.zip .
102 
103 ..\zip\7z e -spf memcached-1.4.5-x86.zip -omemcached
104 ..\zip\7z e -spf redis.zip -oredis
105 
106 cd ..107 rem download python connector tool;
108 pscp -r -l %login_user% -pw %remote_passwd% %remote_host%:%resource_path%/mysql-connector-python-1.0.12-py2.7.msi .

 

启动服务:

 1 rem 服务启动脚本
 2 set home_dir=kp_home
 3 cd %home_dir%
 4 
 5 rem 启动memcache
 6 start .\cache\memcached\memcached-1.4.5-x86\memcached.exe
 7 
 8 rem 启动redis
 9 start .\cache\redis\redis\64bit\redis-server.exe
10 
11 rem 启动proxy
12 cd proxy
13 start startup.bat
14 cd ..15 
16 rem 启动gateway
17 cd gateway
18 start startup.bat
19 cd ..20 
21 rem Tomcat
22 rem cd .\Tomcat\apache-tomcat-7.0.55\bin\
23 rem start catalina.bat run

 

其实主要是想推荐那个下载工具的呢,可以登录到linux下下载文件.

pscp 下载链接: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

 

windows下部署服务脚本