[BAT] BAT sequence executes other bat batch files to set the time interval (actual scenario Windows starts with multiple Tomcat services in turn)

Source: Internet
Author: User

The BAT (batch file) batch is a good thing, the computer Stone age of the weapon, today is still not outdated, the work of accumulating some commonly used batch processing command is still very useful, today to share a practical development used.

Scene:

You need to start multiple Tomcat services under Windows, and you need the first service to start successfully before you can start a second, third service.

Workaround:

The first service judge whether to start successfully, need to read Tomcat Starup.bat output content, to judge to identify, more cumbersome, simplified processing method, is the second, the third service start can be set with the first time interval, such as 2分钟120秒.

Batch Code:

First service startup script Startup1.bat

@echo off Echo "I am the first Tomcat service and everyone relies on me, so I need to start first"

A second service startup script Startup2.bat

@echo off Echo "I am the second Tomcat service and I need the first Tomcat service to start before starting"

A third service startup script Startup3.bat

@echo off Echo "I am the third Tomcat service and I need the first Tomcat service to start before starting"

Start a script for three services in turn Startupall.bat

%cd% represents the current directory, the demo is to put 4 bat files in the same folder, the actual scene, to be replaced with the actual path of the Startup file.

@echo off Echo start the first service Start "" "%cd%\startup1.bat"echo127.0>nulEcho  start the second service start  "" "%cd%\startup2.bat"Echo  launches third service start ""%cd%\startup3.bat "Echo "All services start to complete, automatically shut down after 5seconds" 5 127.0>nulexit

If you think it's useful, please have a 3q!.

[BAT] bat sequence executes other BAT batch files to set the time interval (actual scenario Windows starts with multiple Tomcat services in turn)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.