linuxtomcatstartupregisterstartupscript

Trouble running statrup script on Linux


I'm using the Amazon flavor of Linux

uname -a
Linux mydomain.org 3.19.25-82.99.amzn1.x86_64 #1 SMP Wed Dec 3 21:29:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

and I want to run the following script upon system reboot ...

ls -al /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
-rwxr-xr-x 1 davea mycompany 2023 Nov 28  2011 /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh

So I created this file,

-rwxr-xr-x 1 root root 73 Dec 10 19:29 /etc/init.d/start_tomcat

with the lines

#!/bin/sh

sh /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh

However, when I reboot my system, this script isn't getting invoked. What steps have I left out? I can run the script fine at a command line when I'm logged in.

Edit: Also, I created this symlink in /etc/rc.d ...

ls -al /etc/rc.d/start_tomcat
lrwxrwxrwx 1 root root 24 Dec 10 19:29 /etc/rc.d/start_tomcat -> /etc/init.d/start_tomcat

Still no luck.


Solution

  • You have to add the start-up script under init.d to your default runlevel.

    sudo update-rc.d /etc/init.d/start_tomcat defaults
    

    Which should create symlinks to your script under the appropriate /etc/rc?.d folder(s).