Here's the autorun script, which i use -
#!/bin/sh
# description: Tomcat start/stop script
# chkconfig:
TOMCAT_PATH=/java/apache-tomcat-7.0.32/bin
TOMCAT_START=$TOMCAT_PATH/startup.sh
TOMCAT_STOP=$TOMCAT_PATH/shutdown.sh
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
}
case "$1" in
'start')
start
;;
'stop')
stop
;;
'restart')
restart
;;
*)
echo "Please supply an argument [start|stop|restart]"
esac
I put it in -
/etc/rc.d/init.d/
I added it to the startup:
/sbin/chkconfig --add --level 345 tomcat
But when i reboot the system, watch the logs and see -
catalina.out:
...
INFO: Stopping service Catalina
jan 03, 2013 6:09:04 PM hudson.util.CharacterEncodingFilter destroy
INFO: CharacterEncodingFilter destroyed.
jan 03, 2013 6:09:04 PM javax.jmdns.impl.tasks.state.DNSStateTask run
WARNING: Canceler(www-...-ru.local.).run() exception
java.io.IOException: Invalid argument
at java.net.PlainDatagramSocketImpl.send(Native Method)
at java.net.DatagramSocket.send(DatagramSocket.java:676)
at javax.jmdns.impl.JmDNSImpl.send(JmDNSImpl.java:1537)
at javax.jmdns.impl.tasks.state.DNSStateTask.run(DNSStateTask.java:131)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)
The process does not start.
But if i execute the command -
/etc/rc.d/init.d/tomcat start
The process starts well.
Why does it not start automatically?
Thanks!
who -randls /etc/rc.d/rc<rl>.d/for the appropriate runlevel after the machine starts. – Karlson Jan 4 at 15:02