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

I'm having some problem with my centOS machine.I want to insert a line inside the rc.local to execute apache tomcat on startup. Below are the configuration for /etc/rc.local

#!/bin/sh 
# # This script will be executed *after* all the other init scripts. 
# You can put your own initialization stuff in here if you don't 
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
/opt/apache-jakarta/bin/startup.sh

Unfortunately,the apache tomcat does not start on the boot time. I've already execute the script manually and it is working without any issues. Is there any specific syntax to put script inside the rc.local?Or did I forgetting something?Please Advice.Thanks.

EDIT:

My boot.log only show this output:

Dec 17 21:04:53 localhost NET[2969]: /sbin/dhclient-script : updated /etc/resolv.conf
share|improve this question
    
Check your logs, in particular /var/log/boot.log is where output from the boot scripts is logged. –  Iain Dec 19 '12 at 9:09
    
i've updated the post above with my boot.log –  user119720 Dec 19 '12 at 9:16
    
Ah! It looks like you're using a CentOS 5 system, capture the output of your startup command with /opt/apache-jakarta/bin/startup.sh >/tmp/xyzzy.log 2>&1 Also hunt down and check the relevant apache logs. –  Iain Dec 19 '12 at 9:49
    
yup its centos5 that command need to be put into rc.local is it?I've already done that but there is still no file created in the /tmp folder –  user119720 Dec 19 '12 at 10:07

1 Answer 1

Add the below lines on the top of file "/usr/local/tomcat/bin/daemon.sh"

# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80

Then create a symlink

ll /etc/init.d/tomcat
lrwxrwxrwx. 1 root root 29 Oct 18 22:17 /etc/init.d/tomcat -> /usr/local/tomcat/bin/daemon.sh

Restart your server and your tomcat should be started. Try this method and see if this helps. Make sure you have enabled it in chkconfig

chkconfig --list | grep tomcat
tomcat          0:off   1:off   2:on    3:on    4:on    5:on    6:off
share|improve this answer
    
nope..its not working.regardless,what I want is the command to run apache startup script under /etc/rc.local not creating a new chkconfig –  user119720 Dec 20 '12 at 4:37
1  
is it apache or apache-tomcat ? and if the above method did not work then can you provide the log. Cause after adding to chkconfig you can get the option to start apache-tomcat as service to as "service tomcat start" or "service tomcat stop" . What you are getting? –  PratapSingh Dec 20 '12 at 8:03

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.