文件的结构如下:
|-------java
|------bin
|------jre
|------lib
|----mysql
|-----bin
|----tomcat
|-----bin
|-----service.bat
|-----start.bat
|------stop.bat
这里关注的是这三个BAT文件的写法:
1.service.bat(service install | remove)带的参数为install时,在系统中注册mysql tomcat两个服务。
带的参数为remove 在系统中注销mysql tomcat 两个服务。
=============内容====================
@echo off
set JAVA_HOME=%cd%/java
set CATALINA_HOME=%cd%/tomcat
set MYSQL_HOME=%cd%/mysql
if "%1" == "install" goto install
if "%1" == "remove" goto remove
:install
call "%MYSQL_HOME%/bin/mysqld-nt.exe" install MySQL_ZCMS --defaults-file="%MYSQL_HOME%/my.ini"
net start "MySQL_ZCMS"
call "%CATALINA_HOME%/bin/service" install ZCMS
net start "Apache Tomcat ZCMS"
goto end
:remove
net stop "Apache Tomcat ZCMS"
call "%CATALINA_HOME%/bin/service" remove ZCMS
net stop "MySQL_ZCMS"
call "%MYSQL_HOME%/bin/mysqld-nt.exe" remove MySQL_ZCMS
goto end
:end
=====================================
2 start.bat 只是启动mysql tomcat两个服务
=============内容====================
net start "Mysql_ZCMS"
net start "Apache Tomcat ZCMS"
=====================================
3 stop.bat 只停止这两个服务
=============内容====================
net stop "MySQL_ZCMS"
net stop "Apache Tomcat ZCMS"
=====================================