0

Trying to configure Tomcat for automatically start after boot or reboot my rpi, I follow these steps:

  • The script /etc/init.d/tomcat8 rights:

    sudo chmod 755 /etc/init.d/tomcat8 
    ls -la /etc/init.d/tomcat8 
      -rwxr-xr-x 1 root root 665 Feb 14 21:23 /etc/init.d/tomcat8
    
  • At the beginning of this file I have this line for debugging:

    echo "`/bin/date` $1" >> /var/tmp/tomcat8
    
  • I can run tomcat manually and get the logs successfully in /var/tmp/tomcat8.

    sudo /etc/init.d/tomcat8 start
    

    or

    sudo service tomcat8 start
    
  • I create these symbolic links:

    sudo ln -s /etc/init.d/tomcat8 /etc/rc1.d/K20tomcat8
    sudo ln -s /etc/init.d/tomcat8 /etc/rc0.d/K20tomcat8
    sudo ln -s /etc/init.d/tomcat8 /etc/rc6.d/K20tomcat8
    sudo ln -s /etc/init.d/tomcat8 /etc/rc3.d/S80tomcat8
    sudo ln -s /etc/init.d/tomcat8 /etc/rc4.d/S80tomcat8
    sudo ln -s /etc/init.d/tomcat8 /etc/rc5.d/S80tomcat8
    
  • check the startup services:

    $ chkconfig -list tomcat8
    tomcat8  0:off  1:off  2:on   3:on   4:on   5:on   6:off
    

Then I reboot the rpi. But tomcat doesn't run automatically and I am not getting any log in /var/tmp/tomcat.

Any hint?

4
  • what is the output of dmesg? what if anything appears in /var/log/syslog? – Steve Robillard Feb 14 '15 at 22:30
  • In "cat /var/log/syslog" nothing related with tomcat and with "dmesg" no error/warning. – zeugor Feb 14 '15 at 22:41
  • Well, in answer to your first question, -rwxr-xr-x is 755. Are you saying you did a 755 and ended up with -rw-rw-r-x? – David Nedrow Feb 15 '15 at 21:57
  • @DavidNedrow My first question was very ridiculous. I misundertood the size of the file (655). I thought it was the numeric form of the type access (-rwxr-xr-x), which obviously is 755. Thanks – zeugor Feb 16 '15 at 9:14
1

you should use update-rc.d to make/manage your soft links as I suspect they are missing rights.

Note that init scrips are normaly run with sh and no enviroment, use printenv to compare if you have issues after fixing the links.

/bin/echo "$(/bin/date) $1" >> /var/tmp/tomcat8
1

I came accross the same problem you have. But I learned that raspbian has a default run level of 2, so all you require is

sudo ln -s /etc/init.d/tomcat8 /etc/rc2.d/S80tomcat8

for your script to run at startup.

3
  • it's better to use sudo update-rc.d tomcat8 defaults, which will setup the proper start and stop symlinks. – berto Jul 9 '15 at 13:48
  • I'd agree, but that had no effect for me. Though I have no clue why. They only way i could get the script to run on startup is by the above command. – FusionHS Jul 10 '15 at 10:29
  • you might need header info in your init script: gist.github.com/rca/c312ffd1a13fcf70338e – berto Jul 10 '15 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.