Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

How to restart the tomcat server

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 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 Unix and Linux 10-08-2008
zaxxon's Unix or Linux Image
zaxxon zaxxon is offline Forum Staff  
code tag tagger
Join Date: Sep 2007
Last Activity: 25 September 2017, 9:47 AM EDT
Location: St. Gallen, Switzerland
Posts: 6,572
Thanks: 175
Thanked 560 Times in 481 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 "startup.sh" in your tomcat's bin directory which you might want to use instead.
Sponsored Links
Old Unix and Linux 10-08-2008
nua7 nua7 is offline
Registered User
Join Date: Mar 2008
Last Activity: 15 February 2016, 2:16 AM EST
Location: /bin/sh
Posts: 438
Thanks: 26
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 08:07 AM
Trouble getting consistent PID of tomcat server from ps dkaplowitz Shell Programming and Scripting 1 07-16-2009 11:14 AM
what is the difference between http & Tomcat web server jayaprakash Solaris 2 03-12-2009 03:15 AM
can I use tomcat server for my chatting application? nsharath IP Networking 3 02-11-2009 10:18 AM
TomCat access in an Remote Linux Server gothama UNIX for Dummies Questions & Answers 1 03-13-2008 09:17 AM

All times are GMT -4. The time now is 02:53 PM.