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**************** *************