windows  .bat  批处理

脚本路径如下:

install-simo.bat文件内容:

@ECHO OFF

set scriptpath=%~dp0
set logfile=%scriptpath%install-log.txt
type license.txt | more
:license-check
echo Did you agree with this license(Y/N) :
set/p "cho=>"
if %cho%==Y goto start
if %cho%==y goto start
if %cho%==N call:notagree
if %cho%==n call:notagree
goto license-check

:notagree
echo "you do not agree with license install will exit now!"
pause
exit 1
goto:eof

:start
echo "Start to install SIMO........" >> %logfile%
echo %scriptpath%

call:install-redis
call:install-activemq
call:init-database
ping -n 120 127.0.0.1>nul
call:run-simo

echo  simo install finish..................
pause

exit 0

:install-jdk
mkdir %scriptpath%java\jdk1.8
call %scriptpath%install-java.bat %scriptpath%
echo install-jdk finish
goto:eof

:install-redis
start cmd /k %scriptpath%redis\redis-server.exe %scriptpath%redis\redis.windows.conf
echo install-redis finish

goto:eof

:install-activemq
start cmd /k %scriptpath%activemq\bin\win64\activemq.bat
echo install-activemq finish

goto:eof

:install-database
echo install-database finish
rem 判断windows/system32下是否有对应的mscrv120.dll文件

goto:eof#运行完后 CMD 返回并等待下一条命令

:init-database
start cmd /k %scriptpath%init-postgres.bat %scriptpath%
echo init-database finish

goto:eof

:run-simo
start %scriptpath%simo-init.bat %scriptpath%
echo run-simo finish

goto:eof

simo-init.bat脚本如下:

@ECHO OFF

rem unzip simo.zip
call %17z\7z.exe x %1\simo\simo.zip -o%1simo\
xcopy /Y %1simo\application.properties %1simo\simo\scripts\
cd %1simo\simo\scripts\
rem enable\disable servicecenter
start /b %1simo\simo\scripts\runmodule.bat simo-servicecenter
ping -n 10 127.0.0.1>nul
rem enable\disable mc
start /b %1simo\simo\scripts\runmodule.bat simo-mc
ping -n 10 127.0.0.1>nul
rem enable\disable collector
start /b %1simo\simo\scripts\runmodule.bat simo-collector
ping -n 10 127.0.0.1>nul
rem enable\disable business
start /b %1simo\simo\scripts\runmodule.bat simo-business
ping -n 10 127.0.0.1>nul
rem enable\disable itsm
start /b %1simo\simo\scripts\runmodule.bat simo-itsm
ping -n 10 127.0.0.1>nul
rem enable\disable cmdb
start /b %1simo\simo\scripts\runmodule.bat simo-cmdb
ping -n 10 127.0.0.1>nul
rem enable\disable workflow
start /b %1simo\simo\scripts\runmodule.bat simo-workflow
ping -n 10 127.0.0.1>nul
rem enable\disable knowledgebase
start /b %1simo\simo\scripts\runmodule.bat simo-knowledgebase


run-simo.bat脚本如下:

@ECHO OFF
echo **********************************************
echo.
echo     start to run simo
echo.
echo.
echo **********************************************
set scriptpath=%~dp0

ping -n 10 127.0.0.1>nul
call:start-redis
ping -n 10 127.0.0.1>nul
call:start-activemq
ping -n 10 127.0.0.1>nul
call:start-database
ping -n 10 127.0.0.1>nul

cd %scriptpath%simo\simo\scripts\
rem enable\disable servicecenter
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-servicecenter
ping -n 10 127.0.0.1>nul
rem enable\disable mc
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-mc
ping -n 10 127.0.0.1>nul
rem enable\disable collector
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-collector
ping -n 10 127.0.0.1>nul
rem enable\disable business
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-business
ping -n 10 127.0.0.1>nul
rem enable\disable itsm
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-itsm
ping -n 10 127.0.0.1>nul
rem enable\disable cmdb
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-cmdb
ping -n 10 127.0.0.1>nul
rem enable\disable workflow
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-workflow
ping -n 10 127.0.0.1>nul
rem enable\disable knowledgebase
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-knowledgebase

cd %scriptpath%
echo "DO NOT colse the window!"
cmd /k echo.

:start-redis
start cmd /k %scriptpath%redis\redis-server.exe %scriptpath%redis\redis.windows.conf
echo start-redis finish

goto:eof

:start-activemq
start cmd /k %scriptpath%activemq\bin\win64\activemq.bat
echo start-activemq finish

goto:eof

:start-database
start cmd /k %scriptpath%pgsql\bin\pg_ctl.exe -D "%scriptpath%data" -l logfile start
echo start-database finish
goto:eof

init-postgres.bat  脚本如下:

@ECHO OFF
echo "Start to install postgres........"
rem 检查系统依赖dll
if not exist C:\Windows\System32\msvcr120.dll xcopy /Y %1msvcr120\System32\msvcr120.dll C:\Windows\System32\
echo 检查系统依赖dll完成
rem 修改数据文件夹权限
echo Y|cacls %1data /c /p everyone:f
ping -n 5 127.0.0.1>nul
echo 修改数据文件夹权限
call %1pgsql\bin\initdb.exe -D %1data -E UTF-8 --locale=chs -U uxsino --pwfile=%1postgresconfig\password.txt
ping -n 10 127.0.0.1>nul
rem 修改配置文件
xcopy /EY %1postgresconfig\* %1data
ping -n 5 127.0.0.1>nul
echo config need comfirm
call "pgsql\bin\pg_ctl" -D "%1data" -l logfile start
ping -n 10 127.0.0.1>nul
call %1pgsql\bin\createdb.exe -U uxsino simo_dev
ping -n 10 127.0.0.1>nul
echo database init finish
cmd /k echo.

intall-java.bat  脚本如下:

@ECHO OFF
echo **********************************************
echo.
echo     start to install jdk
echo.
echo.
echo **********************************************
set scriptpath=%~dp0
set logfile=%scriptpath%install-log.txt
echo.
echo installing.......jdk, do not close this windows
echo.
echo please wait about 3/4 mins until install finish
echo.
echo start to install jdk > %logfile%
start /WAIT %scriptpath%java\jdk-8u152-windows-x64.exe /qn INSTALLDIR=%scriptpath%java\jdk1.8
echo install finish start to config java
echo install finish start to config java >> %logfile%
echo.
set JAVA_HOME=%scriptpath%java\jdk1.8
setx Path "%Path%;%JAVA_HOME%\bin" /M
ping -n 30 127.0.0.1>nul
echo install finish and config finish.
echo you can close this window start to install simo
echo java install finish >> %logfile%
cmd /k echo.

run-simo.bat  脚本如下:

@ECHO OFF
echo **********************************************
echo.
echo     start to run simo
echo.
echo.
echo **********************************************
set scriptpath=%~dp0

ping -n 10 127.0.0.1>nul
call:start-redis
ping -n 10 127.0.0.1>nul
call:start-activemq
ping -n 10 127.0.0.1>nul
call:start-database
ping -n 10 127.0.0.1>nul

cd %scriptpath%simo\simo\scripts\
rem enable\disable servicecenter
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-servicecenter
ping -n 10 127.0.0.1>nul
rem enable\disable mc
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-mc
ping -n 10 127.0.0.1>nul
rem enable\disable collector
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-collector
ping -n 10 127.0.0.1>nul
rem enable\disable business
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-business
ping -n 10 127.0.0.1>nul
rem enable\disable itsm
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-itsm
ping -n 10 127.0.0.1>nul
rem enable\disable cmdb
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-cmdb
ping -n 10 127.0.0.1>nul
rem enable\disable workflow
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-workflow
ping -n 10 127.0.0.1>nul
rem enable\disable knowledgebase
start /b %scriptpath%simo\simo\scripts\runmodule.bat simo-knowledgebase

cd %scriptpath%
echo "DO NOT colse the window!"
cmd /k echo.

:start-redis
start cmd /k %scriptpath%redis\redis-server.exe %scriptpath%redis\redis.windows.conf
echo start-redis finish

goto:eof

:start-activemq
start cmd /k %scriptpath%activemq\bin\win64\activemq.bat
echo start-activemq finish

goto:eof

:start-database
start cmd /k %scriptpath%pgsql\bin\pg_ctl.exe -D "%scriptpath%data" -l logfile start
echo start-database finish
goto:eof

自动化部署脚本之windows上执行批处理文件的更多相关文章

  1. 自动化部署脚本--linux执行sh脚本

    自动化部署脚本文件目录: 运行主程序:./install.sh #!/bin/bash SCRIPTPATH=$(cd "$(dirname "$0")"; p ...

  2. Jenkins持续集成-自动化部署脚本的实现

    要实现Jenkins端的持续集成,其实在CI服务配置端很容易,难点呢?就是如何实现自动化的部署.我的脚本设计就是为了解决以下难题: 难点一.如何使得自动化部署脚本更通用 我用的脚本,依赖依赖一个配置文 ...

  3. MySQL5.7多实例自动化部署脚本

    一.安装说明 ------------------------------------------------------ mysql5.7.10_onekey_install.sh自动化部署脚本支持 ...

  4. 《转载》Jenkins持续集成-自动化部署脚本的实现《python》

    本文转载自慕课网 读者须知:1.本手记本着记续接前面的两张手记内容整理2.本手记针对tomcat部署测试环境实现 最近工作比较繁忙,导致这章一直拖延,没有太抽出时间来总结.要实现Jenkins端的持续 ...

  5. 设置ssh免密码登录脚本(hadoop自动化部署脚本一)

    设置ssh免密码登录脚本(hadoop自动化部署脚本一) 设置ssh免密码登录脚本(飞谷云大数据自动化部署脚本一) 1.#!/bin/sh2.#important note:this script i ...

  6. python+paramiko库+svn写的自动化部署脚本

    第一篇博文 直接开门见山的说了. 这是件什么事?:每次部署都是复制本地的文件粘贴到服务器端,因为路径复杂,所以费时且手工容易出漏洞. 一直在想有什么办法可以解决这种,因为以前在微软的一个牛人同事做过一 ...

  7. Mysql安装及自动化部署脚本方案

    一.简介 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库, 每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据. 我们也可以将数据存储在文件中,但是 ...

  8. Web系统自动化部署脚本

    Web开发的项目,除了在本地直接运行外,还可能经常需要在服务器上部署. 写了个自动化部署的脚本,仅供参考. 不少地方需要配置路径,个人建议使用绝对路径,不用依赖执行脚本时所在的路径. #!/bin/s ...

  9. 一个简单的Shell脚本(解决windows上文本在macos上乱码问题)

    之所以有这一篇文章,是因为之前我写过的一篇文章:“解决Mac上打开txt文件乱码问题”:传送门: https://www.cnblogs.com/chester-cs/p/11784079.html ...

随机推荐

  1. Codeforces 1194D. 1-2-K Game

    传送门 先考虑只能走 $1,2$ 步的情况,设 $p[i]$ 表示当 $n=i$ 时先手是否必胜 自己手玩一下发现 $p$ 就是 $011011011...011$ 这样循环(下标从 $0$ 开始,其 ...

  2. Java 父类的static成员在子类中的继承情况

    父类的static成员在子类中的继承状况是怎么样的呢? 昨天突然想到这个问题,刚才试验了一下,发现很容易解释,没什么值得探讨的. 首先在学习继承时,书本都没有强调static成员有什么特殊的地方. 然 ...

  3. Box-shadow制作漂亮的外阴影输入框

    背景:之前做项目中的一个移动端页面,关于在搜索框中输入信息查找对应的照片 改了几次ui图之后,最终的搜索框的设计图如下: 开始做页面的时候,就想到了用box-shadow 来实现外阴影边框.用bord ...

  4. WPF贝塞尔曲线示例

    WPF贝塞尔曲线示例 贝塞尔曲线在之前使用SVG的时候其实就已经有接触到了,但应用未深,了解的不是很多,最近在进行图形操作的时候需要用到贝塞尔曲线,所以又重新来了解WPF中贝塞尔曲线的绘制. 一阶贝塞 ...

  5. 基于EPICS实现西门子S7通信

    (1)       EPICS官网下载Demo并复制文件到指定位置 (2)       创建Modules文件夹,wget https://epics.anl.gov/download/modules ...

  6. 这38个小技巧告诉你如何快速学习MySQL数据库2

    1.如何快速掌握MySQL? ⑴培养兴趣兴趣是最好的老师,不论学习什么知识,兴趣都可以极大地提高学习效率.当然学习MySQL 5.6也不例外.⑵夯实基础计算机领域的技术非常强调基础,刚开始学习可能还认 ...

  7. 把两个object对象合并成一个对象 属性名称相同的变为后面对象的值

    object.assign(from,obj)------object.assign(目标对象,被合并的对象)

  8. 利用selenium 爬取豆瓣 武林外传数据并且完成 数据可视化 情绪分析

    全文的步骤可以大概分为几步: 一:数据获取,利用selenium+多进程(linux上selenium 多进程可能会有问题)+kafka写数据(linux首选必选耦合)windows直接采用的是写my ...

  9. 免费FQ工具

    这里使用免费的`梯子` 下载赛风 选择Windows下载 下载好之后,直接点击打开,它会自动连接,什么也不要设置,下载的就是一个exe文件,连接成功会打开一个网页,不用管

  10. CentOS MySql5.6编译安装

    生产环境中,mysql服务器上边最好什么服务都不要再安装!!! 一.准备工作: # yum -y install make gcc-c++ cmake bison-devel ncurses-deve ...