Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I have a java web app on tomcat installed on the server. How can I setup auto start for it so that it starts up automatically when the server is restarted?

share|improve this question

migrated from stackoverflow.com Feb 1 '10 at 14:04

This question came from our site for professional and enthusiast programmers.

3 Answers 3

/etc/init.d/tomcat-wepappname

#!/bin/sh 
### BEGIN INIT INFO 
# Provides:          tomcat-wepappname 
# Required-Start:    $all 
# Required-Stop:     
# Default-Start:     2 3 4 5 
# Default-Stop:      0 1 6 
# Short-Description: foo bar 
# Description:       long desc
### END INIT INFO 
# Author: Foo Bar <foo@bar.com> 

. /lib/lsb/init-functions 

# Actions 
case "$1" in 
 start) 
  log_action_begin_msg "Starting tomcat webapp" "tomcat-webappname"
  su - tomcat-webappuser -c "/home/sites/tomcat-webappname/webappname.sh $1" 
  log_end_msg 0 
  ;; 
 stop) 
  su - tomcat-webappuser -c "/home/sites/tomcat-webappname/webappname.sh $1" 
  ;; 
# restart) 
# something else...
#  ;; 
esac

exit 0

At least, register the service:

update-rc.d activemq defaults
share|improve this answer
    
i guess it should be : update-rc.d tomcat-wepappname defaults –  Daniel T. Magnusson Mar 19 '13 at 9:41

Use

/sbin/chkconfig tomcat6 on

If you have installed the tomcat6 RPM.

share|improve this answer
    
No man I'm using SUSE Enterprise Linux 9 here –  Daud Ahmad Feb 2 '10 at 5:21
up vote 0 down vote accepted

Found this article here that did it for me.

http://www.sitepoint.com/jsp-quick-start-guide-linux/

share|improve this answer
    
broken link.... –  Daniel T. Magnusson Mar 19 '13 at 9:33
    
Link updated... –  Daud Ahmad Mar 20 '13 at 10:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.