A batch script that I wrote in 2022 to speed up release process of a .war package uploading it on a remote Tomcat web server via SSH protocol.
cd <path of the built archive>
::rename <war name>.war in <war name>.war.new
ren <war name>.war <war name>.war.new
::copy the war.new into the destination folder
plink <ssh user>@<ssh host> -pw <ssh password> < <war name>.new "cat > <ssh release directory>/<war name>.war.new"
:: execution command to shutdown the web server, rename of the war and restart of the Tomcat
cd "<path of the remote commands>"
plink <ssh user>@<ssh host> -pw <ssh password> -m release-<name>-commands.txt
And then the release-<name>-commands.txt
.
<command to shutdown the Tomcat server>
:: backup of the older war
mv <ssh release directory>/<war name>.war <ssh release directory>/<war name>.war.$(date '+%Y%m%d')
echo "COPY NEW test.txt.new"
mv <ssh release directory>/<war name>.war.new <ssh release directory>/<war name>.war
<command to startup the Tomcat server>
<command to tail on the Tomcat logs file>