#!/bin/bash
pid=$(ps -ef | grep tomcat-8.5.42 | grep -v grep | awk '{print $2}')
echo "pid=:${pid}"
read -p "confirm shutdown tomcat and remove cqsg directory (y/n): " confirmed
if [ "${confirmed}" == "y" ] || [ "${confirmed}" == "Y" ];then
kill -9 ${pid}
rm -rf /app/apache-tomcat-8.5.42/webapps/cqsg/
echo "shutdown tomcat and remove cqsg directory Success... "
exit 0
elif [ "${confirmed}" == "n" ] || [ "${confirmed}" == "N" ];then
echo "cancel shutdown tomcat and remove cqsg directory... "
exit 0
fi