How to restart the tomcat server | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to restart the tomcat server

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 10-08-2008
sankar reddy sankar reddy is offline
Registered User
Join Date: Feb 2008
Last Activity: 8 October 2008, 5:32 AM EDT
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
How to restart the tomcat server

I need a command that restart the tomcat server.

for example for restart the tomcat i am using following command, /etc/init.d/tomcat restart ..but sometimes is not working...might be i want to use java code access this peace of script.

like using the grep and ps commands can i use?

1.find the tomcat is running or not if yes find the command and try to execute that command again

for example
ps -ef| grep tomcat >>/dev/null

i am not sure how to write such scenario... please help anybody on this?

Thank you

Sponsored Links
Old 10-08-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
code tag tagger
Join Date: Sep 2007
Last Activity: 27 January 2015, 12:28 AM EST
Location: St. Gallen, Switzerland
Posts: 6,254
Thanks: 126
Thanked 455 Times in 414 Posts
1. You don't need java code for this.
2. You might check why it works only sometimes and fix it or get an update for your OS/tomcat.
3. Depending on distribution etc. there could be somewhere a script like "" in your tomcat's bin directory which you might want to use instead.
Sponsored Links
Old 10-08-2008
nua7 nua7 is offline
Registered User
Join Date: Mar 2008
Last Activity: 20 November 2014, 6:35 AM EST
Location: /bin/sh
Posts: 427
Thanks: 24
Thanked 4 Times in 4 Posts
This can be used..


export OPTS=$*

if [ ! -z "$OPTS" ]; then
   grep -v "EXTRA_JAVA_OPTS" /etc/tomcat5/tomcat5.conf > /tmp/tomcat5.conf
   cp /tmp/tomcat5.conf /etc/tomcat5/tomcat5.conf
   echo EXTRA_JAVA_OPTS=\"$OPTS\" >> /etc/tomcat5/tomcat5.conf
   echo "JAVA_OPTS=\"\$EXTRA_JAVA_OPTS \$JAVA_OPTS\";export JAVA_OPTS" >> /etc/tomcat5/tomcat5.conf

/sbin/service tomcat5 restart

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need a little help in running jsp pages(Tomcat server). pinga123 Programming 3 05-06-2010 09:07 AM
Trouble getting consistent PID of tomcat server from ps dkaplowitz Shell Programming and Scripting 1 07-16-2009 12:14 PM
what is the difference between http & Tomcat web server jayaprakash Solaris 2 03-12-2009 04:15 AM
can I use tomcat server for my chatting application? nsharath IP Networking 3 02-11-2009 11:18 AM
TomCat access in an Remote Linux Server gothama UNIX for Dummies Questions & Answers 1 03-13-2008 10:17 AM

All times are GMT -4. The time now is 06:59 PM.