tomcat startup script not working at boot

Tapas Mishra mightydreams at gmail.com
Fri Feb 25 05:29:51 UTC 2011


On Thu, Feb 17, 2011 at 7:33 PM, Tapas Mishra <mightydreams at gmail.com> wrote:
> I am having problems in starting tomcat at boot time with an automated
> script of mine.
> The Tomcat I am using is 5.5 since Sakai installation of mine depends
> on 5.5 version on any other version it will break.
> So /opt/apache-tomcat-5.5.31 is where every thing is and in that
> bin/startup.sh is what I am trying to start each time at boot.
> After writing the script I have done update-rc.d defaults
> and I checked from command line
> /etc/init.d/tomcatstart
> /etc/init.d/tomcat stop
>
> does work
> where myscript above refers to the script below
>
> but the same does not work when I reboot the system.
>
> #!/bin/bash
> #
> # tomcat
> #
> # chkconfig:
> # description: Start up the Tomcat servlet engine.
>
> # Source function library.
> . /lib/lsb/init-functions
>
> RETVAL=$?
> CATALINA_HOME="/opt/apache-tomcat-5.5.31"
>
> case "$1" in
> start)
> if [ -f $CATALINA_HOME/bin/startup.sh ];
> then
> echo $"Starting Tomcat"
> /opt/apache-tomcat-5.5.31/bin/startup.sh
>
> fi
> ;;
> stop)
> if [ -f $CATALINA_HOME/bin/shutdown.sh ];
> then
> echo $"Stopping Tomcat"
> /opt/apache-tomcat-5.5.31/bin/shutdown.sh
> fi
> ;;
> *)
> echo $"Usage: $0 {start|stop}"
> exit 1
> ;;
> esac
> exit $RETVAL
>
>
> any pointers?
>
>
> --
My script has finally worked.
For some weired reason the script was not working after reboot and it
turns out that this Tomcat was not able to pick JAVA_HOME from .bashrc
at the boot time.So when I defined JAVA_HOME in the above script also
then it did worked.
I do not know why Tomcat could not pick it from .bashrc at boot time
because once the thing completely booted then
/etc/init.d/tapas-script start
was working but to make sure it survives reboots I had to add
JAVA_HOME in this script also (though it was defined in .bashrc)

--------------------

http://mightydreams.blogspot.com




More information about the ubuntu-server mailing list