tag:blogger.com,1999:blog-7774229.post109727256021332360..comments2007-09-22T15:41:46.339-07:00Comments on Space Program Blog: Starting Tomcat as a Service on LinuxTravis Reedernoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7774229.post-80791697369190930032007-09-22T15:41:00.000-07:002007-09-22T15:41:00.000-07:002007-09-22T15:41:00.000-07:00slappy's function doesn't perform well and in any ...slappy's function doesn't perform well and in any case it shows Tomcat as running. It needs to be modified as below<BR/><BR/>if [ $numproc -ne 0 ]; thenHüseyinhttp://www.blogger.com/profile/11860317704263718581noreply@blogger.comtag:blogger.com,1999:blog-7774229.post-74690245020416792602007-03-11T13:11:00.000-07:002007-03-11T13:11:00.000-07:002007-03-11T13:11:00.000-07:00tomcat5 sets default service in /etc/rc.d/init.d d...tomcat5 sets default service in /etc/rc.d/init.d directory, however it does not start automatically. running the chkconfig line starts the service automatically.<BR/><BR/>Thanks for your help!<BR/>KrisKrisenhttp://www.blogger.com/profile/12490469685132100942noreply@blogger.comtag:blogger.com,1999:blog-7774229.post-11284738001795705222007-03-07T16:38:00.000-08:002007-03-07T16:38:00.000-08:002007-03-07T16:38:00.000-08:00To change it so tomcat runs as another user, chang...To change it so tomcat runs as another user, change the $startup line to:<BR/><BR/>su - $user -c "$startup"<BR/><BR/>and $shutdown line to:<BR/><BR/>action $"Stopping Tomcat service: " su - $user "$shutdown"<BR/><BR/>And of course, define user up at the top where the paths are defined. Voila.Alex Shttp://www.blogger.com/profile/09599051277678913514noreply@blogger.comtag:blogger.com,1999:blog-7774229.post-53007154340416425362007-02-15T04:07:00.000-08:002007-02-15T04:07:00.000-08:002007-02-15T04:07:00.000-08:00Hello,The problem with this is that Tomcat is then...Hello,<BR/>The problem with this is that Tomcat is then running as root, isn't it?<BR/>How shall we make it run as another user?<BR/>Thanks,<BR/>TimokTimokhttp://www.blogger.com/profile/03586255616451889292noreply@blogger.comtag:blogger.com,1999:blog-7774229.post-1117828777628111512005-06-03T12:59:00.000-07:002005-06-03T12:59:00.000-07:002005-06-03T12:59:00.000-07:00This seems to work a bit better for me I have foun...This seems to work a bit better for me I have found (running on RHEL3 WS):<BR/>ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat_process_count.txt<BR/> read line < /tmp/tomcat_process_count.txt<BR/>if [ $line -gt 0 ]; then<BR/> echo -n "tomcatd ( pid "<BR/> ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | awk '{printf $1 " "}'<BR/> echo -n ") is running..."<BR/> echo<BR/>else<BR/> echo "Tomcat is stopped"<BR/>firahennighttp://www.blogger.com/profile/16822578406805938065noreply@blogger.comtag:blogger.com,1999:blog-7774229.post-1111098724606988042005-03-17T14:32:00.000-08:002005-03-17T14:32:00.000-08:002005-03-17T14:32:00.000-08:00Here's one way to get a status.. add this function...Here's one way to get a status.. add this function:<BR/><BR/>status(){<BR/> numproc=`ps -ef | grep catalina | grep -v "grep catalina" | wc -l`<BR/> if [ $numproc -gt 0 ]; then<BR/> echo "Tomcat is running..."<BR/> else<BR/> echo "Tomcat is stopped..."<BR/> fi<BR/>}<BR/><BR/>Then call that in your case statement when "status" is used. Hope that helps!Slappyhttp://www.blogger.com/profile/00471786480507295347noreply@blogger.com