Cleanup and server restart script
Adding checks? Just specify

set -e


at the beginning of the script. Should any command fail, the script will stop running, instead of wreaking more damage.

Using variables for repeated paths might make the script more readable.

tomcat1=/home/deploy/tomcatfirst
tomcat2=/home/deploy/tomcatsecond

sh "$tomcat1"/bin/catalina.sh stop


(BTW, shouldn't the second stop use $tomcat2?)

Once you have them, changing the above line to

set -eu


might be another improvement - the script will fail if a variable is not defined, which can happen if you mistype its name.

As the commands for both the server are the same, you can wrap them in a loop:

for tomcat /home/deploy/tomcat{first,second} ; do
    sh "$tomcat"/bin/catalina.sh stop
    # ...
done


If the servers are critical, you should specify the commands with full paths (e.g. /bin/mkdir).