2

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?

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

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

1

/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
  • 1
    i guess it should be : update-rc.d tomcat-wepappname defaults – Daniel T. Magnusson Mar 19 '13 at 9:41
0

Use

/sbin/chkconfig tomcat6 on

If you have installed the tomcat6 RPM.

  • 1
    No man I'm using SUSE Enterprise Linux 9 here – Daud Ahmad Khokhar Feb 2 '10 at 5:21
0

Found this article here that did it for me.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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