Windows Tomcat project update and database backup script __ Database

Source: Internet
Author: User

I use a batch processing, that is executed with CMD, if the use of PowerShell execution may have problems

Mine is the installation version of the TOMCAT,TOMCAT has been installed into service


Automatically update projects and deploy to delete backup data prior to this month

REM *******************************code start*****************************
@echo off

set "ymd=%date:~,4%% date:~5,2%%date:~8,2% "
cp" D:\Apache Software foundation\tomcat 7.0\webapps\cloudolp.dc.war "D:\backup\" Cloudolp.dc\%ymd%.war
cd "D:\PROJECT\CLOUDOLP.DC"
git pull
grails war
net stop Tomcat7

rmdir/s/ Q "D:\Apache Software foundation\tomcat 7.0\webapps\cloudolp.dc"

net start Tomcat7
Set "firstdate=%date:~,4%/ %date:~5,2%/01 "
forfiles/p d:\backup\cloudolp.dc/d  -%firstdate%/C" cmd/c del/f @path "
@echo 
on REM *******************************code end*****************************

Back up the database, delete the backup data before this month

REM *******************************code start*****************************
@echo off

set "ymd=%date:~,4%% date:~5,2%%date:~8,2% "
mysqldump--opt-u root--default-character-set=utf8--password=xxoo Datacenter > D:\ Backup\datacenter\%ymd%.sql
Set "firstdate=%date:~,4%/%date:~5,2%/01"
forfiles/p d:\backup\datacenter/d  -%firstdate%/C "cmd/c del/f @path"
@echo on
rem *******************************code end**************** *************



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.