Reputation: 795
Now I'm using the below script to start & stop the tomcat in a server.
Now i want to modify it to stop or start a remote tomcat base on IP address.
Please give me some suggestions.
CATALINA_HOME=/home/tomcat; export CATALINA_HOME
start() {
echo -n "Starting Tomcat: "
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/startup.sh
status=$(tail -50 $CATALINA_HOME/logs/catalina.out | grep "Server startup")
echo "$status"
}
stop() {
echo -n "Stopping Tomcat: "
su $TOMCAT_OWNER -c $CATALINA_HOME/bin/shutdown.sh
ps -eaf | grep "$CATALINA_HOME/bin" | grep -v "grep" |awk -F " " '{print $2}' >> proc_id
cat proc_id | while read line
do
kill -9 $line >> Tomcat_stop.log
done
rm -rf proc_id
}
Upvotes: 0
Views: 762
Reputation: 20063
Is there a reason you can't just ssh onto the server and restart tomcat?
That would be the normal way of restarting the tomcat remotely.
Upvotes: 1