I just installed Tomcat and when I run the chkconfig -add tomcat, it tells me that tomcat does not support chkconfig. Suggestions? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.centos.org/pipermail/centos/attachments/20060502/a84cc5cb/attachment-0003.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3022 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20060502/a84cc5cb/attachment-0003.bin>
> I just installed Tomcat and when I run the chkconfig -add tomcat, it tells > me that tomcat does not support chkconfig.In order to support chkconfig, an init script must: 1. Be located in /etc/rc.d/init.d (which /etc/init.d is a symlink to) 2. Have a commented out line that contains "chkconfig: <default runlevels for this service> <start priority> <stop priority>" 3. Have a commented out line that contains "description: <a description of the service>" 4. Upon successful service startup, place a lock file in /var/lock/subsys that matches the name of the service script. Upon successful service shutdown, the lockfile must be removed. It is worth noting that you must use "chkconfig --add <service name>" in order to have the service script placed in the shutdown/restart runlevels correctly. There are many great examples already provided by existing services. They should be fairly straightforward reading. Best of luck, Barry
That was it! I didn't have the chkconfig: line... Thanks. -----Original Message----- From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Nick Sent: Tuesday, May 02, 2006 10:32 PM To: CentOS mailing list Subject: Re: [CentOS] Starting tomcat on bootup Barry Brimer wrote:>> I just installed Tomcat and when I run the chkconfig -add tomcat, it >> tells >> me that tomcat does not support chkconfig. > > In order to support chkconfig, an init script must: > 1. Be located in /etc/rc.d/init.d (which /etc/init.d is a symlink to) > 2. Have a commented out line that contains "chkconfig: <default > runlevels for this service> <start priority> <stop priority>" > 3. Have a commented out line that contains "description: <a > description of the service>" > 4. Upon successful service startup, place a lock file in > /var/lock/subsys that matches the name of the service script. Upon > successful service shutdown, the lockfile must be removed. > > It is worth noting that you must use "chkconfig --add <service name>" > in order to have the service script placed in the shutdown/restart > runlevels correctly. > > There are many great examples already provided by existing services. > They should be fairly straightforward reading.Here's the init script we use, if it helps at all: #!/bin/sh # # Tomcat Server # # chkconfig: 345 96 30 # description: Java servlet container JAVA_HOME=/opt/jdk PATH=${JAVA_HOME}/bin:${PATH} TOMCAT_START=/opt/tomcat/bin/startup.sh TOMCAT_STOP=/opt/tomcat/bin/shutdown.sh export JAVA_HOME PATH start() { if [ -x ${TOMCAT_START} ]; then echo "Starting tomcat server..." ${TOMCAT_START} & else echo "Cannot start tomcat server" fi } stop() { if [ -x ${TOMCAT_STOP} ]; then echo "Stopping tomcat server..." ${TOMCAT_STOP} & else echo "Cannot stop tomcat server" fi } restart() { stop sleep 10 start } status() { echo "No status available for tomcat server" } case "$1" in 'start') start ;; 'stop') stop ;; 'restart') restart ;; 'status') status ;; *) echo "Please supply an argument [start|stop|restart]" esac _______________________________________________ CentOS mailing list CentOS at centos.org http://lists.centos.org/mailman/listinfo/centos -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3095 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20060502/87ac4a31/attachment-0003.bin>
#!/bin/sh # # tomcat: Starts the Jakarta tomcat server # # Version: @(#) /etc/init.d/tomcat 1.0 # # chkconfig: 2345 55 45 # description: Starts and stops the Jakarta tomcat server at boot time and shutdown. # # processname: tomcat # Source function library. . /etc/init.d/functions start() { echo -n $"Starting tomcat: " su - tomcat -c '$CATALINA_HOME/bin/startup.sh' ret=$? [ $ret -eq 0 ] && (touch /var/lock/subsys/tomcat; echo_success) echo return $ret } stop() { echo -n $"Shutting down tomcat: " su - tomcat -c '$CATALINA_HOME/bin/shutdown.sh' ret=$? [ $ret -eq 0 ] && rm -f /var/lock/subsys/tomcat echo return $ret } rhstatus() { status tomcat } reload() { if [ -f /var/lock/subsys/tomcat ]; then echo -n $"Reloading tomcat: " killproc tomcat -USR1 ret=$? echo return $ret else stop start fi } restart() { echo $"Restarting tomcat:" stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) reload ;; condrestart) [ -f /var/lock/subsys/tomcat ] && reload || : ;; status) rhstatus ;; *) echo $"*** Usage: tomcat {start|stop|status|restart|reload|condrestart}" exit 1 esac exit $? -- [ ]s, LRU #391067 Analista de Rede Leandro Costa :wq ...... __@ ...._ \ >_ ...(_)/ (_)_________